@Override public V get(Object key) { return getOrDefault(key, defaultValue); } }
/** * Construct DefaultingDictionary using the given defaultValue and entries from the given defaultingDictionaryMap. * * @param defaultValue The defaultValue to be returned if a key is not present in the map * @param defaultingDictionaryMap A Map whose entries will be inserted into the DefaultingDictionary */ public DefaultingDictionary(V defaultValue, Map<K, V> defaultingDictionaryMap) { this.defaultValue = defaultValue; this.putAll(defaultingDictionaryMap); }
/** * Build a Map of Class to Function that should be used to get requestedIntervals from the DruidQuery. * * @return A Map that maps Class to a function that computes the requested intervals for a Druid query of * that particular Class */ protected Map<Class, RequestedIntervalsFunction> buildSigningFunctions() { DefaultingDictionary<Class, RequestedIntervalsFunction> signingFunctions = new DefaultingDictionary<>( druidAggregationQuery -> new SimplifiedIntervalList(druidAggregationQuery.getIntervals()) ); signingFunctions.put(LookbackQuery.class, new LookbackQuery.LookbackQueryRequestedIntervalsFunction()); return signingFunctions; }
/** * Build a SegmentIntervalsHashIdGenerator that uses the raw simplified intervals of a druidAggregationQuery to * create a segmentId. * * @param dataSourceMetadataService A Service to get information about segment metadata */ public SegmentIntervalsHashIdGenerator(DataSourceMetadataService dataSourceMetadataService) { this( dataSourceMetadataService, new DefaultingDictionary<>( druidAggregationQuery -> new SimplifiedIntervalList(druidAggregationQuery.getIntervals()) ) ); }