Module java.money
Package javax.money

Class RoundingQueryBuilder

java.lang.Object

public final class RoundingQueryBuilder
extends AbstractQueryBuilder<RoundingQueryBuilder,​RoundingQuery>
Builder used to construct new instances of RoundingQuery}.

Note this class is NOT thread-safe.

  • Method Details

    • setRoundingName

      public RoundingQueryBuilder setRoundingName​(java.lang.String roundingName)
      Sets the rounding names of the MonetaryRounding instances. This method allows to access the MonetaryRounding instances by passing a name, which most of the time identifies a certain rounding instance. Each entry is first matched as name on equality. If no instance with such a name exists, the value passed is interpreted as a regular expression to lookup roundings.
      Parameters:
      roundingName - the (custom) rounding name expression, not null.
      Returns:
      this instance for chaining
    • setScale

      public RoundingQueryBuilder setScale​(int scale)
      Sets the target scale. This allows to define the scale required. If not specified as additional attribute, by default, RoundingMode.HALF_EVEN is used hereby.
      Parameters:
      scale - the target scale, >0.
      Returns:
      this instance for chaining
    • setCurrency

      public RoundingQueryBuilder setCurrency​(CurrencyUnit currencyUnit)
      Sets the target CurrencyUnit, which defines a rounding targeting a concrete CurrencyUnit. Typically this determines all other properties, such as scale and the concrete rounding algorithm. With rounding names, depending on the implementation, additional subselections are possible. Similarly additional attributes can be used to select special rounding instances, e.g. for cash rounding.
      Parameters:
      currencyUnit - the target CurrencyUnit not null.
      Returns:
      this instance for chaining
    • build

      public RoundingQuery build()
      Creates a new instance of RoundingQuery.
      Specified by:
      build in class AbstractQueryBuilder<RoundingQueryBuilder,​RoundingQuery>
      Returns:
      a new RoundingQuery instance.
    • of

      public static RoundingQueryBuilder of()
      Returns:
      Creates a new RoundingQueryBuilder.
    • of

      public static RoundingQueryBuilder of​(RoundingQuery roundingQuery)
      Creates a new RoundingQueryBuilder.
      Parameters:
      roundingQuery - the rounding query, used as a template, not null.
      Returns:
      a new RoundingQueryBuilder instance, never null.