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