Module java.money
Package javax.money

Class AbstractQueryBuilder<B extends AbstractQueryBuilder,​C extends AbstractQuery>

java.lang.Object
javax.money.AbstractContextBuilder<B,​C>
javax.money.AbstractQueryBuilder<B,​C>
Direct Known Subclasses:
AmountFormatQueryBuilder, ConversionQueryBuilder, CurrencyQueryBuilder, MonetaryAmountFactoryQueryBuilder, RoundingQueryBuilder

public abstract class AbstractQueryBuilder<B extends AbstractQueryBuilder,​C extends AbstractQuery>
extends AbstractContextBuilder<B,​C>
This abstract class defines the common generic parts of a query. Queries are used to pass complex parameters sets to lookup monetary artifacts, e.g. MonetaryAmountFactory, MonetaryRounding, CurrencyUnit, ExchangeRateProvider and .CurrencyConversion.

Instances of this class are not thread-safe and not serializable.

  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractQueryBuilder()
    Initializes the query builder, as a default query builder.
  • Method Summary

    Modifier and Type Method Description
    abstract C build()
    Creates a new AbstractQuery with the data from this Builder instance.
    B set​(java.util.List<java.lang.String> providers)
    Set the providers to be considered.
    B setProviderName​(java.lang.String provider)
    Simple override, that sets the provider as provider to use.
    B setProviderNames​(java.lang.String... providers)
    Set the providers to be considered.
    B setProviderNames​(java.util.List<java.lang.String> providers)
    Set the providers to be considered.
    B setTargetType​(java.lang.Class<?> type)
    Sets the target implementation type required.

    Methods inherited from class javax.money.AbstractContextBuilder

    importContext, importContext, removeAttributes, set, set, set, set, set, set, set, set, set, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AbstractQueryBuilder

      public AbstractQueryBuilder()
      Initializes the query builder, as a default query builder.
  • Method Details

    • setProviderNames

      public B setProviderNames​(java.lang.String... providers)
      Set the providers to be considered. If not set explicitly the default ISO currencies as returned by Currency is used.
      Parameters:
      providers - the providers to use, not null.
      Returns:
      the query builder for chaining.
    • setProviderNames

      public B setProviderNames​(java.util.List<java.lang.String> providers)
      Set the providers to be considered. If not set explicitly the default ISO currencies as returned by Currency is used.
      Parameters:
      providers - the providers to use, not null.
      Returns:
      the query builder for chaining.
    • set

      public B set​(java.util.List<java.lang.String> providers)
      Set the providers to be considered. If not set explicitly the default providers and the corresponding default ordering are used.
      Parameters:
      providers - the providers in order to use, not null.
      Returns:
      the query builder for chaining.
    • setProviderName

      public B setProviderName​(java.lang.String provider)
      Simple override, that sets the provider as provider to use.
      Overrides:
      setProviderName in class AbstractContextBuilder<B extends AbstractQueryBuilder,​C extends AbstractQuery>
      Parameters:
      provider - the provider, not null.
      Returns:
      the query builder for chaining.
    • setTargetType

      public B setTargetType​(java.lang.Class<?> type)
      Sets the target implementation type required. This can be used to explicitly acquire a specific implementation type and use a query to configure the instance or factory to be returned.
      Parameters:
      type - the target implementation type, not null.
      Returns:
      this query builder for chaining.
    • build

      public abstract C build()
      Creates a new AbstractQuery with the data from this Builder instance.
      Specified by:
      build in class AbstractContextBuilder<B extends AbstractQueryBuilder,​C extends AbstractQuery>
      Returns:
      a new AbstractQuery. never null.