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.annotation.Priority;
019import javax.money.MonetaryAmountFactory;
020import javax.money.MonetaryContext;
021import javax.money.spi.MonetaryAmountFactoryProviderSpi;
022
023import org.javamoney.moneta.Money;
024
025/**
026 * Implementation of {@link MonetaryAmountFactoryProviderSpi} creating instances of
027 * {@link MoneyAmountBuilder}.
028 *
029 * @author Anatole Tresch
030 */
031@Priority(10)
032public final class MoneyAmountFactoryProvider implements MonetaryAmountFactoryProviderSpi<Money>{
033
034    @Override
035    public Class<Money> getAmountType(){
036        return Money.class;
037    }
038
039    @Override
040    public MonetaryAmountFactory<Money> createMonetaryAmountFactory(){
041        return new MoneyAmountBuilder();
042    }
043
044    /*
045     * (non-Javadoc)
046     * @see MonetaryAmountFactoryProviderSpi#getQueryInclusionPolicy()
047     */
048    @Override
049    public QueryInclusionPolicy getQueryInclusionPolicy(){
050        return QueryInclusionPolicy.ALWAYS;
051    }
052
053    @Override
054    public MonetaryContext getDefaultMonetaryContext(){
055        return MoneyAmountBuilder.DEFAULT_CONTEXT;
056    }
057
058    @Override
059    public MonetaryContext getMaximalMonetaryContext(){
060        return MoneyAmountBuilder.MAX_CONTEXT;
061    }
062}