001/**
002 * Copyright (c) 2012, 2014, Credit Suisse (Anatole Tresch), Werner Keil and others by the @author tag.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005 * use this file except in compliance with the License. You may obtain a copy of
006 * the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013 * License for the specific language governing permissions and limitations under
014 * the License.
015 */
016package org.javamoney.moneta.internal;
017
018import javax.money.MonetaryAmountFactory;
019import javax.money.MonetaryContext;
020import javax.money.spi.MonetaryAmountFactoryProviderSpi;
021
022import org.javamoney.moneta.FastMoney;
023
024/**
025 * Implementation of {@link MonetaryAmountFactoryProviderSpi} creating instances of
026 * {@link FastMoneyAmountBuilder}.
027 *
028 * @author Anatole Tresch
029 */
030public final class FastMoneyAmountFactoryProvider implements MonetaryAmountFactoryProviderSpi<FastMoney>{
031
032    @Override
033    public Class<FastMoney> getAmountType(){
034        return FastMoney.class;
035    }
036
037    @Override
038    public MonetaryAmountFactory<FastMoney> createMonetaryAmountFactory(){
039        // TODO ensure context!
040        return new FastMoneyAmountBuilder();
041    }
042
043    /*
044     * (non-Javadoc)
045     * @see javax.money.spi.MonetaryAmountFactoryProviderSpi#getQueryInclusionPolicy()
046     */
047    @Override
048    public QueryInclusionPolicy getQueryInclusionPolicy(){
049        return QueryInclusionPolicy.ALWAYS;
050    }
051
052    @Override
053    public MonetaryContext getDefaultMonetaryContext(){
054        return FastMoneyAmountBuilder.DEFAULT_CONTEXT;
055    }
056
057    @Override
058    public MonetaryContext getMaximalMonetaryContext(){
059        return FastMoneyAmountBuilder.MAX_CONTEXT;
060    }
061
062}