@Test public void createFromGetterOnly() { final DummyInjectionTarget target = new DummyInjectionTarget(); final IDependencyObject<String> dep = DependencyObjectHelper.createFromGetterOnly(() -> "Value", "Default"); Assert.assertTrue(dep instanceof PropertyBasedDependencyObject); Assert.assertEquals("Value", dep.get(target)); dep.set(target, "NotValue"); Assert.assertEquals("Value", dep.get(target)); }
public static <T> IDependencyObject<T> createFromGetterOnly( @NotNull final Function<Object, T> dependencyGetter, @NotNull final T defaultValue ) { return createFromProperty( PropertyCreationHelper.create( Optional.of(dependencyGetter), Optional.empty(), true ), defaultValue ); }
DependencyObjectHelper { public static <T> IDependencyObject<T> createFromGetterOnly( @NotNull final Function<Object, T> dependencyGetter, @NotNull final T defaultValue ) { return createFromProperty( PropertyCreationHelper.create( Optional.of(dependencyGetter), Optional.empty(), true ), defaultValue ); } }
DependencyObjectHelper { public static <T> IDependencyObject<T> createFromGetterOnly( @NotNull final Function<Object, T> dependencyGetter, @NotNull final T defaultValue ) { return createFromProperty( PropertyCreationHelper.create( Optional.of(dependencyGetter), Optional.empty(), true ), defaultValue ); } private  DependencyObjectHelper(); }
DependencyObjectHelper { public static <T> IDependencyObject<T> createFromGetterOnly( @NotNull final Function<Object, T> dependencyGetter, @NotNull final T defaultValue ) { return createFromProperty( PropertyCreationHelper.create( Optional.of(dependencyGetter), Optional.empty(), true ), defaultValue ); } 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> IDependencyObject<T> createFromGetterOnly( @NotNull final Function<Object, T> dependencyGetter, @NotNull final T defaultValue ) { return createFromProperty( PropertyCreationHelper.create( Optional.of(dependencyGetter), Optional.empty(), true ), defaultValue ); } 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
    );  }