Class AudioClipBuilder

java.lang.Object
io.github.sosuisen.jfxbuilder.media.AudioClipBuilder

public class AudioClipBuilder extends Object
The AudioClipBuilder class constructs instances of the AudioClip 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 AudioClip constructor and returns an instance of the AudioClipBuilder.

You can use method chaining to call the builder methods for configuring the AudioClip. Finally, invoke the build method to generate an instance of the AudioClip 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 AudioClipBuilder create(String source)
      Accepts the constructor arguments of AudioClip(String) and returns an instance of AudioClipBuilder.
      Returns:
      an instance of the AudioClipBuilder.
    • build

      public AudioClip build()
      Builds and returns an instance of the AudioClip 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 AudioClip class
    • apply

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

      public AudioClipBuilder balance(double balance)
      A builder method that invokes the setBalance method on the instance being constructed.
      Returns:
      builder instance
    • cycleCount

      public AudioClipBuilder cycleCount(int count)
      A builder method that invokes the setCycleCount method on the instance being constructed.
      Returns:
      builder instance
    • pan

      public AudioClipBuilder pan(double pan)
      A builder method that invokes the setPan method on the instance being constructed.
      Returns:
      builder instance
    • priority

      public AudioClipBuilder priority(int priority)
      A builder method that invokes the setPriority method on the instance being constructed.
      Returns:
      builder instance
    • rate

      public AudioClipBuilder rate(double rate)
      A builder method that invokes the setRate method on the instance being constructed.
      Returns:
      builder instance
    • volume

      public AudioClipBuilder volume(double value)
      A builder method that invokes the setVolume method on the instance being constructed.
      Returns:
      builder instance
    • balancePropertyApply

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

      Example:

      // Use apply
      .apply(obj -> obj.balanceProperty().bind(anotherProperty))
      
      // Use shorthand form
      .balancePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • cycleCountPropertyApply

      public AudioClipBuilder cycleCountPropertyApply(Consumer<IntegerProperty> op)
      Applies a function to the cycleCountProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.cycleCountProperty().bind(anotherProperty))
      
      // Use shorthand form
      .cycleCountPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • panPropertyApply

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

      Example:

      // Use apply
      .apply(obj -> obj.panProperty().bind(anotherProperty))
      
      // Use shorthand form
      .panPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • priorityPropertyApply

      public AudioClipBuilder priorityPropertyApply(Consumer<IntegerProperty> op)
      Applies a function to the priorityProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.priorityProperty().bind(anotherProperty))
      
      // Use shorthand form
      .priorityPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • ratePropertyApply

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

      Example:

      // Use apply
      .apply(obj -> obj.rateProperty().bind(anotherProperty))
      
      // Use shorthand form
      .ratePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • volumePropertyApply

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

      Example:

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