@Test public void set() { final IDependencyObject<String> input = new StaticDependencyObject<>("Input"); final IDependencyObject<String> target = new TransformingDependencyObject<>(input, s -> s.replace("In", "Out"), s -> s.replace("Out", "In")); Assert.assertEquals("Output", target.get(new DummyInjectionTarget())); target.set(new DummyInjectionTarget(), "Test"); Assert.assertEquals("Test", target.get(new DummyInjectionTarget())); target.set(new DummyInjectionTarget(), "Output"); Assert.assertEquals("Input", input.get(new DummyInjectionTarget())); Assert.assertEquals("Output", target.get(new DummyInjectionTarget())); }
@Override public void set(@Nullable final Object context, @Nullable final T value) { inputDependency.set(context, setTransformer.apply(value)); }
TransformingDependencyObject implements IDependencyObject<T> { @Override public void set(@Nullable final Object context, @Nullable final T value) { inputDependency.set(context, setTransformer.apply(value)); } }
TransformingDependencyObject implements IDependencyObject<T> { @Override public void set(@Nullable final Object context, @Nullable final T value) { inputDependency.set(context, setTransformer.apply(value)); } TransformingDependencyObject(
      final IDependencyObject<I> inputDependency,
      final Function<I, T> getTransformer,
      final Function<T, I> setTransformer); }
TransformingDependencyObject implements IDependencyObject<T> { @Override public void set(@Nullable final Object context, @Nullable final T value) { inputDependency.set(context, setTransformer.apply(value)); } TransformingDependencyObject(
      final IDependencyObject<I> inputDependency,
      final Function<I, T> getTransformer,
      final Function<T, I> setTransformer); @Override boolean requiresDataContext(); @Nullable @Override T get(@Nullable final Object context); @Override void set(@Nullable final Object context, @Nullable final T value); @Override boolean hasChanged(@Nullable final Object context); }
TransformingDependencyObject implements IDependencyObject<T> { @Override public void set(@Nullable final Object context, @Nullable final T value) { inputDependency.set(context, setTransformer.apply(value)); } TransformingDependencyObject(
      final IDependencyObject<I> inputDependency,
      final Function<I, T> getTransformer,
      final Function<T, I> setTransformer); @Override boolean requiresDataContext(); @Nullable @Override T get(@Nullable final Object context); @Override void set(@Nullable final Object context, @Nullable final T value); @Override boolean hasChanged(@Nullable final Object context);  }