@Test public void transform() { final DummyInjectionTarget target = new DummyInjectionTarget(); final IDependencyObject<String> input = new TestInputDependencyObject(); final IDependencyObject<String> transformed = DependencyObjectHelper.transform(input, s -> s.replace("World", "Test"), s -> s.replace("Test", "World")); Assert.assertTrue(transformed.hasChanged(target)); Assert.assertEquals("HelloTest", transformed.get(target)); transformed.set(target, "HelloTest"); Assert.assertEquals("HelloWorld", input.get(target)); transformed.set(target, "Hello"); Assert.assertEquals("Hello", input.get(target)); }
public static <T, I> IDependencyObject<T> transform( final IDependencyObject<I> inputDependency, final Function<I, T> getTransformer, final Function<T, I> setTransformer) { return new TransformingDependencyObject<>(inputDependency, getTransformer, setTransformer); }
DependencyObjectHelper { public static <T, I> IDependencyObject<T> transform( final IDependencyObject<I> inputDependency, final Function<I, T> getTransformer, final Function<T, I> setTransformer) { return new TransformingDependencyObject<>(inputDependency, getTransformer, setTransformer); } }
DependencyObjectHelper { public static <T, I> IDependencyObject<T> transform( final IDependencyObject<I> inputDependency, final Function<I, T> getTransformer, final Function<T, I> setTransformer) { return new TransformingDependencyObject<>(inputDependency, getTransformer, setTransformer); } private  DependencyObjectHelper(); }
DependencyObjectHelper { public static <T, I> IDependencyObject<T> transform( final IDependencyObject<I> inputDependency, final Function<I, T> getTransformer, final Function<T, I> setTransformer) { return new TransformingDependencyObject<>(inputDependency, getTransformer, setTransformer); } private  DependencyObjectHelper(); static IDependencyObject<T> createFromValue(@Nullable T value); static IDependencyObject<T> transform(
      final IDependencyObject<I> inputDependency,
      final Function<I, T> getTransformer,
      final Function<T, I> setTransformer); static IDependencyObject<T> createFromGetterOnly(
      @NotNull final Function<Object, T> dependencyGetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromProperty(@NotNull Property<T> property, @Nullable T def); static IDependencyObject<T> createFromGetterOnly(
      @NotNull final Supplier<T> dependencyGetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterOnly(
      @NotNull final BiConsumer<Object, T> dependencySetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterOnly(
      @NotNull final Consumer<T> dependencySetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterAndGetter(
      @NotNull final Function<Object, T> dependencyGetter,
      @NotNull final BiConsumer<Object, T> dependencySetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterAndGetter(
      @NotNull final Supplier<T> dependencyGetter,
      @NotNull final Consumer<T> dependencySetter,
      @NotNull final T defaultValue
    ); }
DependencyObjectHelper { public static <T, I> IDependencyObject<T> transform( final IDependencyObject<I> inputDependency, final Function<I, T> getTransformer, final Function<T, I> setTransformer) { return new TransformingDependencyObject<>(inputDependency, getTransformer, setTransformer); } private  DependencyObjectHelper(); static IDependencyObject<T> createFromValue(@Nullable T value); static IDependencyObject<T> transform(
      final IDependencyObject<I> inputDependency,
      final Function<I, T> getTransformer,
      final Function<T, I> setTransformer); static IDependencyObject<T> createFromGetterOnly(
      @NotNull final Function<Object, T> dependencyGetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromProperty(@NotNull Property<T> property, @Nullable T def); static IDependencyObject<T> createFromGetterOnly(
      @NotNull final Supplier<T> dependencyGetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterOnly(
      @NotNull final BiConsumer<Object, T> dependencySetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterOnly(
      @NotNull final Consumer<T> dependencySetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterAndGetter(
      @NotNull final Function<Object, T> dependencyGetter,
      @NotNull final BiConsumer<Object, T> dependencySetter,
      @NotNull final T defaultValue
    ); static IDependencyObject<T> createFromSetterAndGetter(
      @NotNull final Supplier<T> dependencyGetter,
      @NotNull final Consumer<T> dependencySetter,
      @NotNull final T defaultValue
    );  }