/*
 * Decompiled with CFR 0.152.
 */
package org.jivesoftware.smack.filter;

import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter;
import org.jivesoftware.smack.filter.OrFilter;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.Objects;

public class IQTypeFilter
extends FlexibleStanzaTypeFilter<IQ> {
    public static final StanzaFilter GET = new IQTypeFilter(IQ.Type.get);
    public static final StanzaFilter SET = new IQTypeFilter(IQ.Type.set);
    public static final StanzaFilter RESULT = new IQTypeFilter(IQ.Type.result);
    public static final StanzaFilter ERROR = new IQTypeFilter(IQ.Type.error);
    public static final StanzaFilter GET_OR_SET = new OrFilter(GET, SET);
    private final IQ.Type type;

    private IQTypeFilter(IQ.Type type) {
        super(IQ.class);
        this.type = Objects.requireNonNull(type, "Type must not be null");
    }

    @Override
    protected boolean acceptSpecific(IQ iq) {
        return iq.getType() == this.type;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + ": type=" + (Object)((Object)this.type);
    }
}
