java.lang.Object
io.github.sosuisen.jfxbuilder.web.WebHistoryBuilder

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

You can use method chaining to call the builder methods for configuring the WebHistory. Finally, invoke the build method to generate an instance of the WebHistory 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

    • build

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

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

      public WebHistoryBuilder maxSize(int value)
      A builder method that invokes the setMaxSize method on the instance being constructed.
      Returns:
      builder instance
    • addEntries

      public final WebHistoryBuilder addEntries(WebHistory.Entry... elements)
      Calls the addAll method on the ObservableList returned by the WebHistory#getEntries() method.
      Returns:
      builder instance
    • addEntries

      public final WebHistoryBuilder addEntries(Collection<? extends WebHistory.Entry> col)
      Calls the addAll method on the ObservableList returned by the WebHistory#getEntries() method.
      Returns:
      builder instance
    • currentIndexPropertyApply

      public WebHistoryBuilder currentIndexPropertyApply(Consumer<ReadOnlyIntegerProperty> op)
      Applies a function to the currentIndexProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.currentIndexProperty().bind(anotherProperty))
      
      // Use shorthand form
      .currentIndexPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • maxSizePropertyApply

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

      Example:

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