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 theaddAll
method on the ObservableList returned by theListSpinnerValueFactory#getItems()
method.Calls theaddAll
method on the ObservableList returned by theListSpinnerValueFactory#getItems()
method.Applies a function to the ListSpinnerValueFactory instance being constructed.build()
Builds and returns an instance of theListSpinnerValueFactory
class.converter
(StringConverter<T> newValue) A builder method that invokes thesetConverter
method on the instance being constructed.Applies a function to theconverterProperty
of 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 thesetItems
method on the instance being constructed.Applies a function to theitemsProperty
of the instance being constructed.A builder method that invokes thesetValue
method on the instance being constructed.Applies a function to thevalueProperty
of the instance being constructed.wrapAround
(boolean value) A builder method that invokes thesetWrapAround
method on the instance being constructed.Applies a function to thewrapAroundProperty
of 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 theListSpinnerValueFactory
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
ListSpinnerValueFactory
class
-
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 thesetConverter
method on the instance being constructed.- Returns:
- builder instance
-
items
A builder method that invokes thesetItems
method on the instance being constructed.- Returns:
- builder instance
-
value
A builder method that invokes thesetValue
method on the instance being constructed.- Returns:
- builder instance
-
wrapAround
A builder method that invokes thesetWrapAround
method on the instance being constructed.- Returns:
- builder instance
-
addItems
@SafeVarargs public final SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> addItems(T... elements) Calls theaddAll
method on the ObservableList returned by theListSpinnerValueFactory#getItems()
method.- Returns:
- builder instance
-
addItems
public final SpinnerValueFactoryListSpinnerValueFactoryBuilder<T> addItems(Collection<? extends T> col) Calls theaddAll
method 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 theconverterProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 theitemsProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 thevalueProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 thewrapAroundProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.wrapAroundProperty().bind(anotherProperty)) // Use shorthand form .wrapAroundPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-