java.lang.Object
io.github.sosuisen.jfxbuilder.controls.PieChartDataBuilder

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

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

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

      Applies a function to the Data instance being constructed. Most operations on the instance can be performed using this method.
      Returns:
      builder instance
    • name

      public PieChartDataBuilder name(String value)
      A builder method that invokes the setName method on the instance being constructed.
      Returns:
      builder instance
    • pieValue

      public PieChartDataBuilder pieValue(double value)
      A builder method that invokes the setPieValue method on the instance being constructed.
      Returns:
      builder instance
    • chartPropertyApply

      public PieChartDataBuilder chartPropertyApply(Consumer<ReadOnlyObjectProperty<PieChart>> op)
      Applies a function to the chartProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.chartProperty().bind(anotherProperty))
      
      // Use shorthand form
      .chartPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • namePropertyApply

      public PieChartDataBuilder namePropertyApply(Consumer<StringProperty> op)
      Applies a function to the nameProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.nameProperty().bind(anotherProperty))
      
      // Use shorthand form
      .namePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • nodePropertyApply

      public PieChartDataBuilder nodePropertyApply(Consumer<ReadOnlyObjectProperty<Node>> op)
      Applies a function to the nodeProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.nodeProperty().bind(anotherProperty))
      
      // Use shorthand form
      .nodePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • pieValuePropertyApply

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

      Example:

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