@Test public void put_using_producer() { MutableContext<?> ctx = new MutableContext<>(ts_data, alert_manager); ctx.putSupplied("identifier", String.class, (c) -> Optional.of(DATA), () -> ALIAS); assertSame(DATA, ctx.getFromIdentifier(String.class, "identifier").get()); assertSame(DATA, ctx.getFromIdentifier(CharSequence.class, "identifier").get()); assertEquals(Optional.empty(), ctx.getFromIdentifier(Float.class, "identifier")); assertSame(ALIAS, ctx.getAliasFromIdentifier(String.class, "identifier").get()); assertSame(ALIAS, ctx.getAliasFromIdentifier(CharSequence.class, "identifier").get()); assertEquals(Optional.empty(), ctx.getAliasFromIdentifier(Float.class, "identifier")); }
public <T, U> void putSupplied(String identifier, Class<T> type, Function<Context, Optional<? extends T>> function, Supplier<U> alias) { all_identifiers_.put(identifier, new ProducedValue<T, U>(type, function, alias)); }
MutableContext extends SimpleContext<TSDataPair> { public <T, U> void putSupplied(String identifier, Class<T> type, Function<Context, Optional<? extends T>> function, Supplier<U> alias) { all_identifiers_.put(identifier, new ProducedValue<T, U>(type, function, alias)); } }
MutableContext extends SimpleContext<TSDataPair> { public <T, U> void putSupplied(String identifier, Class<T> type, Function<Context, Optional<? extends T>> function, Supplier<U> alias) { all_identifiers_.put(identifier, new ProducedValue<T, U>(type, function, alias)); } MutableContext(TSDataPair ts_data, Consumer<Alert> alert_manager);  MutableContext(Context<? extends TSDataPair> copy);  MutableContext(TSDataPair ts_data, Context copy); }
MutableContext extends SimpleContext<TSDataPair> { public <T, U> void putSupplied(String identifier, Class<T> type, Function<Context, Optional<? extends T>> function, Supplier<U> alias) { all_identifiers_.put(identifier, new ProducedValue<T, U>(type, function, alias)); } MutableContext(TSDataPair ts_data, Consumer<Alert> alert_manager);  MutableContext(Context<? extends TSDataPair> copy);  MutableContext(TSDataPair ts_data, Context copy); void put(String identifier, Class<T> type, T value, U alias); void put(String identifier, Class<T> type, Optional<T> value, U alias); void putSupplied(String identifier, Class<T> type, Function<Context, Optional<? extends T>> function, Supplier<U> alias); void putGroupAlias(String identifier, Optional<SimpleGroupPath> group); void putGroupAlias(String identifier, SimpleGroupPath group); void putGroupAliasByName(String identifier, Supplier<GroupName> group); void putMetricAliasByName(String identifier, Supplier<GroupName> group, Supplier<MetricName> metric); void remove(String identifier); @Override Map<String, ContextIdentifier> getAllIdentifiers(); }
MutableContext extends SimpleContext<TSDataPair> { public <T, U> void putSupplied(String identifier, Class<T> type, Function<Context, Optional<? extends T>> function, Supplier<U> alias) { all_identifiers_.put(identifier, new ProducedValue<T, U>(type, function, alias)); } MutableContext(TSDataPair ts_data, Consumer<Alert> alert_manager);  MutableContext(Context<? extends TSDataPair> copy);  MutableContext(TSDataPair ts_data, Context copy); void put(String identifier, Class<T> type, T value, U alias); void put(String identifier, Class<T> type, Optional<T> value, U alias); void putSupplied(String identifier, Class<T> type, Function<Context, Optional<? extends T>> function, Supplier<U> alias); void putGroupAlias(String identifier, Optional<SimpleGroupPath> group); void putGroupAlias(String identifier, SimpleGroupPath group); void putGroupAliasByName(String identifier, Supplier<GroupName> group); void putMetricAliasByName(String identifier, Supplier<GroupName> group, Supplier<MetricName> metric); void remove(String identifier); @Override Map<String, ContextIdentifier> getAllIdentifiers();  }