Class ReflectionBuilder
java.lang.Object
io.github.sosuisen.jfxbuilder.graphics.ReflectionBuilder
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 Summary
Modifier and TypeMethodDescriptionapply(Consumer<Reflection> func) Applies a function to the Reflection instance being constructed.bottomOpacity(double value) A builder method that invokes thesetBottomOpacitymethod on the instance being constructed.Applies a function to thebottomOpacityPropertyof the instance being constructed.build()Builds and returns an instance of theReflectionclass.static ReflectionBuildercreate()Returns an instance of theReflectionBuilder.static ReflectionBuildercreate(double topOffset, double fraction, double topOpacity, double bottomOpacity) Accepts the constructor arguments ofReflection(double, double, double, double)and returns an instance ofReflectionBuilder.fraction(double value) A builder method that invokes thesetFractionmethod on the instance being constructed.Applies a function to thefractionPropertyof the instance being constructed.A builder method that invokes thesetInputmethod on the instance being constructed.Applies a function to theinputPropertyof the instance being constructed.topOffset(double value) A builder method that invokes thesetTopOffsetmethod on the instance being constructed.Applies a function to thetopOffsetPropertyof the instance being constructed.topOpacity(double value) A builder method that invokes thesetTopOpacitymethod on the instance being constructed.Applies a function to thetopOpacityPropertyof the instance being constructed.
-
Method Details
-
create
Returns an instance of theReflectionBuilder.- Returns:
- an instance of the
ReflectionBuilder.
-
create
public static ReflectionBuilder create(double topOffset, double fraction, double topOpacity, double bottomOpacity) Accepts the constructor arguments ofReflection(double, double, double, double)and returns an instance ofReflectionBuilder.- Returns:
- an instance of the
ReflectionBuilder.
-
build
Builds and returns an instance of theReflectionclass.Intermediate builder methods are not evaluated until the
buildmethod is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
Reflectionclass
-
apply
Applies a function to the Reflection instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
bottomOpacity
A builder method that invokes thesetBottomOpacitymethod on the instance being constructed.- Returns:
- builder instance
-
fraction
A builder method that invokes thesetFractionmethod on the instance being constructed.- Returns:
- builder instance
-
input
A builder method that invokes thesetInputmethod on the instance being constructed.- Returns:
- builder instance
-
topOffset
A builder method that invokes thesetTopOffsetmethod on the instance being constructed.- Returns:
- builder instance
-
topOpacity
A builder method that invokes thesetTopOpacitymethod on the instance being constructed.- Returns:
- builder instance
-
bottomOpacityPropertyApply
Applies a function to thebottomOpacityPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.bottomOpacityProperty().bind(anotherProperty)) // Use shorthand form .bottomOpacityPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
fractionPropertyApply
Applies a function to thefractionPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.fractionProperty().bind(anotherProperty)) // Use shorthand form .fractionPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
inputPropertyApply
Applies a function to theinputPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.inputProperty().bind(anotherProperty)) // Use shorthand form .inputPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
topOffsetPropertyApply
Applies a function to thetopOffsetPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.topOffsetProperty().bind(anotherProperty)) // Use shorthand form .topOffsetPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
topOpacityPropertyApply
Applies a function to thetopOpacityPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.topOpacityProperty().bind(anotherProperty)) // Use shorthand form .topOpacityPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-