package org.terracotta.statistics.registry;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public final class OperationStatisticDescriptor<T extends Enum<T>> {
private final String observerName;
private final Set<String> tags;
private final Class<T> type;
private OperationStatisticDescriptor(String observerName, Set<String> tags, Class<T> type) {
this.observerName = observerName;
this.tags = Collections.unmodifiableSet(tags);
this.type = type;
}
public String getObserverName() {
return observerName;
}
public Set<String> getTags() {
return tags;
}
public Class<T> getType() {
return type;
}
public static <T extends Enum<T>> OperationStatisticDescriptor<T> descriptor(String observerName, Set<String> tags, Class<T> type) {
return new OperationStatisticDescriptor<>(observerName, tags, type);
}
public static <T extends Enum<T>> OperationStatisticDescriptor<T> descriptor(String observerName, Class<T> type, String... tags) {
return new OperationStatisticDescriptor<>(observerName, new HashSet<>(Arrays.asList(tags)), type);
}
}