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.format; 017 018import java.text.DecimalFormat; 019import java.util.Objects; 020 021import javax.money.MonetaryAmount; 022import javax.money.format.MonetaryAmountFormat; 023 024import org.javamoney.moneta.spi.MonetaryAmountProducer; 025import org.javamoney.moneta.spi.MoneyProducer; 026 027 028/** 029 *The {@link MonetaryAmountFormat} that uses the {@link MonetaryAmountSymbols} to format {@link MonetaryAmount}. 030 * @author Otavio Santana 031 * @see {@link MonetaryAmountSymbols} 032 * @see {@link MonetaryAmountFormat} 033 * @see {@link MonetaryAmountNumericInformation} 034 * @deprecated 035 */ 036@Deprecated 037public interface MonetaryAmountFormatSymbols extends MonetaryAmountFormat { 038 039 /** 040 * Gets the {@link MonetaryAmountSymbols} used in this {@link MonetaryAmountFormatSymbols} 041 * @return symbols 042 */ 043 MonetaryAmountSymbols getAmountSymbols(); 044 /** 045 * Gets the {@link MonetaryAmountNumericInformation} used in this {@link MonetaryAmountFormatSymbols} 046 * @return numeric information 047 */ 048 MonetaryAmountNumericInformation getNumericInformation(); 049 050 /** 051 * Creates {@link MonetaryAmountSymbols} using the symbols and producer 052 * @param symbols 053 * @param producer 054 * @return the {@link MonetaryAmountSymbols} 055 * @see {@link MonetaryAmountSymbols} 056 * @see {@link MonetaryAmountFormatSymbols} 057 * @see {@link MonetaryAmountProducer} 058 */ 059 static MonetaryAmountFormatSymbols of(MonetaryAmountSymbols symbols, MonetaryAmountProducer producer) { 060 return new DefaultMonetaryAmountFormatSymbols(Objects.requireNonNull(symbols), Objects.requireNonNull(producer)); 061 } 062 /** 063 * Creates {@link MonetaryAmountSymbols} using the pattern and symbol. 064 * @param pattern 065 * @param symbols 066 * @param producer 067 * @return the {@link MonetaryAmountSymbols} 068 * @see {@link MonetaryAmountSymbols} 069 * @see {@link MonetaryAmountFormatSymbols} 070 * @see {@link MonetaryAmountProducer} 071 * @see {@link DecimalFormat} 072 */ 073 static MonetaryAmountFormatSymbols of(String pattern, MonetaryAmountSymbols symbols, MonetaryAmountProducer producer) { 074 return new DefaultMonetaryAmountFormatSymbols( 075 Objects.requireNonNull(pattern), 076 Objects.requireNonNull(symbols), 077 Objects.requireNonNull(producer)); 078 } 079 /** 080 * Creates a default {@link MonetaryAmountSymbols}. 081 * @return the {@link MonetaryAmountSymbols} 082 * @see {@link MonetaryAmountSymbols} 083 * @see {@link MonetaryAmountFormatSymbols} 084 * @see {@link MonetaryAmountProducer} 085 * @see {@link DecimalFormat} 086 */ 087 static MonetaryAmountFormatSymbols getDefafult() { 088 return new DefaultMonetaryAmountFormatSymbols(new MonetaryAmountSymbols(), new MoneyProducer()); 089 } 090 091}