protected <K, V, S extends Enum<S>, T extends Enum<T>> OperationStatistic<T> createTranslatedStatistic(BaseStore<K, V> store, String statisticName, Map<T, Set<S>> translation, String targetName) { Class<S> outcomeType = getOutcomeType(translation); // If the original stat doesn't exist, we do not need to translate it if (StatsUtils.hasOperationStat(store, outcomeType, targetName)) { int tierHeight = getResourceType().getTierHeight(); OperationStatistic<T> stat = new MappedOperationStatistic<>(store, translation, statisticName, tierHeight, targetName, store .getStatisticsTag()); StatisticsManager.associate(stat).withParent(store); return stat; } return ZeroOperationStatistic.get(); }
public MappedOperationStatistic(Object tier, Map<D, Set<S>> translation, String statisticName, int tierHeight, String targetName, String discriminator) { this.name = statisticName; this.tags = Collections.singleton("tier"); this.properties = new HashMap<>(); this.properties.put("tierHeight", tierHeight); this.properties.put("discriminator", discriminator); Entry<D, Set<S>> first = translation.entrySet().iterator().next(); Class<S> outcomeType = first.getValue().iterator().next().getDeclaringClass(); this.outcomeType = first.getKey().getDeclaringClass(); this.mapper = new StatisticMapper<>(translation, findOperationStat(tier, outcomeType, targetName)); }
protected <K, V, S extends Enum<S>, T extends Enum<T>> OperationStatistic<T> createTranslatedStatistic(BaseStore<K, V> store, String statisticName, Map<T, Set<S>> translation, String targetName) { Class<S> outcomeType = getOutcomeType(translation); // If the original stat doesn't exist, we do not need to translate it if (StatsUtils.hasOperationStat(store, outcomeType, targetName)) { int tierHeight = getResourceType().getTierHeight(); OperationStatistic<T> stat = new MappedOperationStatistic<>(store, translation, statisticName, tierHeight, targetName, store .getStatisticsTag()); StatisticsManager.associate(stat).withParent(store); return stat; } return ZeroOperationStatistic.get(); }