Class SpinnerValueFactoryListSpinnerValueFactoryBuilder<T>
java.lang.Object
io.github.sosuisen.jfxbuilder.controls.SpinnerValueFactoryListSpinnerValueFactoryBuilder<T>
The
SpinnerValueFactoryListSpinnerValueFactoryBuilder class constructs instances of the ListSpinnerValueFactory 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 ListSpinnerValueFactory constructor
and returns an instance of the SpinnerValueFactoryListSpinnerValueFactoryBuilder.
You can use method chaining to call the builder methods for configuring the ListSpinnerValueFactory.
Finally, invoke the build method to generate an instance of the ListSpinnerValueFactory 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 TypeMethodDescriptionaddItems(Collection<? extends T> col) Calls theaddAllmethod on the ObservableList returned by theListSpinnerValueFactory#getItems()method.Calls theaddAllmethod on the ObservableList returned by theListSpinnerValueFactory#getItems()method.Applies a function to the ListSpinnerValueFactory instance being constructed.build()Builds and returns an instance of theListSpinnerValueFactoryclass.converter(StringConverter<T> newValue) A builder method that invokes thesetConvertermethod on the instance being constructed.Applies a function to theconverterPropertyof the instance being constructed.static <T> SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> create(ObservableList<T> items) Accepts the constructor arguments ofListSpinnerValueFactory(ObservableList)and returns an instance ofSpinnerValueFactoryListSpinnerValueFactoryBuilder<T>.items(ObservableList<T> value) A builder method that invokes thesetItemsmethod on the instance being constructed.Applies a function to theitemsPropertyof the instance being constructed.A builder method that invokes thesetValuemethod on the instance being constructed.Applies a function to thevaluePropertyof the instance being constructed.wrapAround(boolean value) A builder method that invokes thesetWrapAroundmethod on the instance being constructed.Applies a function to thewrapAroundPropertyof the instance being constructed.
-
Method Details
-
create
public static <T> SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> create(ObservableList<T> items) Accepts the constructor arguments ofListSpinnerValueFactory(ObservableList)and returns an instance ofSpinnerValueFactoryListSpinnerValueFactoryBuilder<T>.- Returns:
- an instance of the
SpinnerValueFactoryListSpinnerValueFactoryBuilder<T>.
-
build
Builds and returns an instance of theListSpinnerValueFactoryclass.Intermediate builder methods are not evaluated until the
buildmethod is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
ListSpinnerValueFactoryclass
-
apply
public SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> apply(Consumer<SpinnerValueFactory.ListSpinnerValueFactory<T>> func) Applies a function to the ListSpinnerValueFactory instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
converter
A builder method that invokes thesetConvertermethod on the instance being constructed.- Returns:
- builder instance
-
items
A builder method that invokes thesetItemsmethod on the instance being constructed.- Returns:
- builder instance
-
value
A builder method that invokes thesetValuemethod on the instance being constructed.- Returns:
- builder instance
-
wrapAround
A builder method that invokes thesetWrapAroundmethod on the instance being constructed.- Returns:
- builder instance
-
addItems
@SafeVarargs public final SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> addItems(T... elements) Calls theaddAllmethod on the ObservableList returned by theListSpinnerValueFactory#getItems()method.- Returns:
- builder instance
-
addItems
public final SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> addItems(Collection<? extends T> col) Calls theaddAllmethod on the ObservableList returned by theListSpinnerValueFactory#getItems()method.- Returns:
- builder instance
-
converterPropertyApply
public SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> converterPropertyApply(Consumer<ObjectProperty<StringConverter<T>>> op) Applies a function to theconverterPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.converterProperty().bind(anotherProperty)) // Use shorthand form .converterPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
itemsPropertyApply
public SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> itemsPropertyApply(Consumer<ObjectProperty<ObservableList<T>>> op) Applies a function to theitemsPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.itemsProperty().bind(anotherProperty)) // Use shorthand form .itemsPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
valuePropertyApply
public SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> valuePropertyApply(Consumer<ObjectProperty<T>> op) Applies a function to thevaluePropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.valueProperty().bind(anotherProperty)) // Use shorthand form .valuePropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
wrapAroundPropertyApply
public SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> wrapAroundPropertyApply(Consumer<BooleanProperty> op) Applies a function to thewrapAroundPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.wrapAroundProperty().bind(anotherProperty)) // Use shorthand form .wrapAroundPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-