Class MediaBuilder
java.lang.Object
io.github.sosuisen.jfxbuilder.media.MediaBuilder
The
MediaBuilder class constructs instances of the Media 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 Media constructor
and returns an instance of the MediaBuilder.
You can use method chaining to call the builder methods for configuring the Media.
Finally, invoke the build method to generate an instance of the Media 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 TypeMethodDescriptionfinal MediaBuilderaddTracks(Collection<? extends Track> col) Calls theaddAllmethod on the ObservableList returned by theMedia#getTracks()method.final MediaBuilderCalls theaddAllmethod on the ObservableList returned by theMedia#getTracks()method.Applies a function to the Media instance being constructed.build()Builds and returns an instance of theMediaclass.static MediaBuilderAccepts the constructor arguments ofMedia(String)and returns an instance ofMediaBuilder.Applies a function to thedurationPropertyof the instance being constructed.Applies a function to theerrorPropertyof the instance being constructed.Applies a function to theheightPropertyof the instance being constructed.A builder method that invokes thesetOnErrormethod on the instance being constructed.Applies a function to theonErrorPropertyof the instance being constructed.Applies a function to thewidthPropertyof the instance being constructed.
-
Method Details
-
create
Accepts the constructor arguments ofMedia(String)and returns an instance ofMediaBuilder.- Returns:
- an instance of the
MediaBuilder.
-
build
-
apply
Applies a function to the Media instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
onError
A builder method that invokes thesetOnErrormethod on the instance being constructed.- Returns:
- builder instance
-
addTracks
Calls theaddAllmethod on the ObservableList returned by theMedia#getTracks()method.- Returns:
- builder instance
-
addTracks
Calls theaddAllmethod on the ObservableList returned by theMedia#getTracks()method.- Returns:
- builder instance
-
durationPropertyApply
Applies a function to thedurationPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.durationProperty().bind(anotherProperty)) // Use shorthand form .durationPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
errorPropertyApply
Applies a function to theerrorPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.errorProperty().bind(anotherProperty)) // Use shorthand form .errorPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
heightPropertyApply
Applies a function to theheightPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.heightProperty().bind(anotherProperty)) // Use shorthand form .heightPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
onErrorPropertyApply
Applies a function to theonErrorPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.onErrorProperty().bind(anotherProperty)) // Use shorthand form .onErrorPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
widthPropertyApply
Applies a function to thewidthPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.widthProperty().bind(anotherProperty)) // Use shorthand form .widthPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-