Class ReflectionBuilder

java.lang.Object
io.github.sosuisen.jfxbuilder.graphics.ReflectionBuilder

public class ReflectionBuilder extends Object
The ReflectionBuilder class constructs instances of the Reflection class and offers a fluent interface for creating and configuring it.

This class includes a static create method that accepts the same arguments as the original Reflection constructor and returns an instance of the ReflectionBuilder.

You can use method chaining to call the builder methods for configuring the Reflection. Finally, invoke the build method to generate an instance of the Reflection class.

Note that intermediate builder methods are not evaluated until the build method is called, meaning they are evaluated lazily.

Author:
Hidekazu Kubota <hidekazu.kubota@gmail.com>
  • Method Details

    • create

      public static ReflectionBuilder create()
      Returns an instance of the ReflectionBuilder.
      Returns:
      an instance of the ReflectionBuilder.
    • create

      public static ReflectionBuilder create(double topOffset, double fraction, double topOpacity, double bottomOpacity)
      Accepts the constructor arguments of Reflection(double, double, double, double) and returns an instance of ReflectionBuilder.
      Returns:
      an instance of the ReflectionBuilder.
    • build

      public Reflection build()
      Builds and returns an instance of the Reflection class.

      Intermediate builder methods are not evaluated until the build method is called; in other words, they are evaluated lazily.

      Returns:
      new instance of the Reflection class
    • apply

      public ReflectionBuilder apply(Consumer<Reflection> func)
      Applies a function to the Reflection instance being constructed. Most operations on the instance can be performed using this method.
      Returns:
      builder instance
    • bottomOpacity

      public ReflectionBuilder bottomOpacity(double value)
      A builder method that invokes the setBottomOpacity method on the instance being constructed.
      Returns:
      builder instance
    • fraction

      public ReflectionBuilder fraction(double value)
      A builder method that invokes the setFraction method on the instance being constructed.
      Returns:
      builder instance
    • input

      public ReflectionBuilder input(Effect value)
      A builder method that invokes the setInput method on the instance being constructed.
      Returns:
      builder instance
    • topOffset

      public ReflectionBuilder topOffset(double value)
      A builder method that invokes the setTopOffset method on the instance being constructed.
      Returns:
      builder instance
    • topOpacity

      public ReflectionBuilder topOpacity(double value)
      A builder method that invokes the setTopOpacity method on the instance being constructed.
      Returns:
      builder instance
    • bottomOpacityPropertyApply

      public ReflectionBuilder bottomOpacityPropertyApply(Consumer<DoubleProperty> op)
      Applies a function to the bottomOpacityProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.bottomOpacityProperty().bind(anotherProperty))
      
      // Use shorthand form
      .bottomOpacityPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • fractionPropertyApply

      public ReflectionBuilder fractionPropertyApply(Consumer<DoubleProperty> op)
      Applies a function to the fractionProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.fractionProperty().bind(anotherProperty))
      
      // Use shorthand form
      .fractionPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • inputPropertyApply

      public ReflectionBuilder inputPropertyApply(Consumer<ObjectProperty<Effect>> op)
      Applies a function to the inputProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.inputProperty().bind(anotherProperty))
      
      // Use shorthand form
      .inputPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • topOffsetPropertyApply

      public ReflectionBuilder topOffsetPropertyApply(Consumer<DoubleProperty> op)
      Applies a function to the topOffsetProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.topOffsetProperty().bind(anotherProperty))
      
      // Use shorthand form
      .topOffsetPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • topOpacityPropertyApply

      public ReflectionBuilder topOpacityPropertyApply(Consumer<DoubleProperty> op)
      Applies a function to the topOpacityProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.topOpacityProperty().bind(anotherProperty))
      
      // Use shorthand form
      .topOpacityPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance