All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.money.AbstractQueryBuilder Maven / Gradle / Ivy

Go to download

JSR 354 provides an API for representing, transporting, and performing comprehensive calculations with Money and Currency. This module provides a forward compatible backport of the API.

There is a newer version: 1.0.4
Show newest version
/*
 * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE CONDITION THAT YOU
 * ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT. PLEASE READ THE TERMS AND CONDITIONS OF THIS
 * AGREEMENT CAREFULLY. BY DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF
 * THE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE" BUTTON AT THE
 * BOTTOM OF THIS PAGE. Specification: JSR-354 Money and Currency API ("Specification") Copyright
 * (c) 2012-2014, Credit Suisse All rights reserved.
 */
package javax.money;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 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. {@link MonetaryAmountFactory},
 * {@link MonetaryRounding},
 * {@link CurrencyUnit}, {@link javax.money.convert.ExchangeRateProvider} and {@link org.javamoney.bp.api.convert
 * .CurrencyConversion}.
 * 

* Instances of this class are not thread-safe and not serializable. */ @SuppressWarnings("ALL") public abstract class AbstractQueryBuilder extends AbstractContextBuilder { /** * Initializes the query builder, as a default query builder. */ public AbstractQueryBuilder() { } /** * Set the providers to be considered. If not set explicitly the default ISO currencies as * returned by {@link java.util.Currency} is used. * * @param providers the providers to use, not null. * @return the query builder for chaining. */ public B setProviderNames(String... providers) { return setProviderNames(Arrays.asList(providers)); } /** * Set the providers to be considered. If not set explicitly the default ISO currencies as * returned by {@link java.util.Currency} is used. * * @param providers the providers to use, not null. * @return the query builder for chaining. */ public B setProviderNames(List providers) { Objects.requireNonNull(providers); return set(AbstractQuery.KEY_QUERY_PROVIDERS, providers); } /** * Set the providers to be considered. If not set explicitly the default providers and the corresponding * default ordering are used. * * @param providers the providers in order to use, not null. * @return the query builder for chaining. */ public B set(List providers) { return set(AbstractQuery.KEY_QUERY_PROVIDERS, providers); } /** * Simple override, that sets the provider as provider to use. * * @param provider the provider, not null. * @return the query builder for chaining. */ @Override public B setProviderName(String provider) { return setProviderNames(provider); } /** * 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. * * @param type the target implementation type, not null. * @return this query builder for chaining. */ public B setTargetType(Class type) { Objects.requireNonNull(type); set(AbstractQuery.KEY_QUERY_TARGET_TYPE, type); return (B) this; } /** * Creates a new {@link AbstractQuery} with the data from this Builder * instance. * * @return a new {@link AbstractQuery}. never {@code null}. */ @Override public abstract C build(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy