001/* 002 * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE CONDITION THAT YOU 003 * ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT. PLEASE READ THE TERMS AND CONDITIONS OF THIS 004 * AGREEMENT CAREFULLY. BY DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF 005 * THE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE" BUTTON AT THE 006 * BOTTOM OF THIS PAGE. Specification: JSR-354 Money and Currency API ("Specification") Copyright 007 * (c) 2012-2013, Credit Suisse All rights reserved. 008 */ 009package org.javamoney.moneta.spi.base; 010 011import javax.money.MonetaryAmount; 012import javax.money.MonetaryContext; 013import javax.money.spi.MonetaryAmountFactoryProviderSpi; 014 015/** 016 * SPI (core): Implementations of this interface are used by the {@link javax.money.spi.MonetaryAmountsSingletonSpi} to evaluate the 017 * correct {@link javax.money.MonetaryAmountFactory} instances. 018 * 019 * @param <T> the concrete amount type. 020 * @author Anatole Tresch 021 */ 022public abstract class BaseMonetaryAmountFactoryProviderSpi<T extends MonetaryAmount> 023implements MonetaryAmountFactoryProviderSpi<T>{ 024 025 /** 026 * Method that determines if this factory should be considered for general evaluation of 027 * matching {@link javax.money.MonetaryAmount} implementation types when calling 028 * {@link javax.money.Monetary#getAmountFactory(javax.money.MonetaryAmountFactoryQuery)}. 029 * 030 * @return {@code true} to include this factory into the evaluation. 031 * @see javax.money.Monetary#getAmountFactory(javax.money.MonetaryAmountFactoryQuery) 032 */ 033 public QueryInclusionPolicy getQueryInclusionPolicy(){ 034 return QueryInclusionPolicy.ALWAYS; 035 } 036 037 /** 038 * Returns the maximal {@link javax.money.MonetaryContext} supported, for requests that exceed these maximal 039 * capabilities, an {@link ArithmeticException} must be thrown. 040 * 041 * @return the maximal {@link javax.money.MonetaryContext} supported, never {@code null} 042 */ 043 public MonetaryContext getMaximalMonetaryContext(){ 044 return getDefaultMonetaryContext(); 045 } 046 047}