package io.undertow.server.handlers.encoding;
import io.undertow.predicate.Predicate;
final class EncodingMapping implements Comparable<EncodingMapping> {
private final String name;
private final ContentEncodingProvider encoding;
private final int priority;
private final Predicate allowed;
EncodingMapping(final String name, final ContentEncodingProvider encoding, final int priority, final Predicate allowed) {
this.name = name;
this.encoding = encoding;
this.priority = priority;
this.allowed = allowed;
}
public String getName() {
return name;
}
public ContentEncodingProvider getEncoding() {
return encoding;
}
public int getPriority() {
return priority;
}
public Predicate getAllowed() {
return allowed;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof EncodingMapping)) return false;
EncodingMapping that = (EncodingMapping) o;
return this.compareTo(that) == 0;
}
@Override
public int hashCode() {
return getPriority();
}
@Override
public int compareTo(final EncodingMapping o) {
return priority - o.priority;
}
}