org.sodatest.coercion.java
Class CurrencyAmountCoercionForJava<T>
java.lang.Object
org.sodatest.coercion.Coercion<A>
org.sodatest.coercion.CurrencyAmountCoercion<T>
org.sodatest.coercion.java.CurrencyAmountCoercionForJava<T>
- All Implemented Interfaces:
- scala.ScalaObject
public class CurrencyAmountCoercionForJava<T>
- extends org.sodatest.coercion.CurrencyAmountCoercion<T>
Coerces strings that are currency amounts (e.g. "($25,000.00)") to a specified strong type for
storing such amounts.
Example
{{{
public class MySodaEvent extends ReflectiveSodaEventForJava {
var coercionRegister = new CoercionRegisterForJava(new CurrencyAmountCoercionForJava(classOf[MyMoneyClass]))
...
}}}
The target class for the Coercion must provide a public, one-parameter constructor that accepts
either a BigDecimal, a BigDecimal or a String.
By default, the patterns accepted by the coercion are:
#,##0.00
-#,##0.00
(#,##0.00)
$#,##0.00
-$#,##0.00
$-#,##0.00
($#,##0.00)
$(#,##0.00)
You can, if necessary, specify the patterns to be used by passing into the constructor the
decimalFormatPatterns parameter, which must be a list of patterns acceptable to
DecimalFormat.
The CurrencyAmountCoercionForJava.PatternFactory class provides functions to aid in the construction of such pattern lists.
- See Also:
CurrencyAmountCoercionForJava.PatternFactory,
DecimalFormat,
CurrencyAmountCoercion
| Nested classes/interfaces inherited from class org.sodatest.coercion.CurrencyAmountCoercion |
org.sodatest.coercion.CurrencyAmountCoercion.$anonfun$1, org.sodatest.coercion.CurrencyAmountCoercion.$anonfun$2, org.sodatest.coercion.CurrencyAmountCoercion.$anonfun$apply$1 |
| Nested classes/interfaces inherited from class org.sodatest.coercion.Coercion |
org.sodatest.coercion.Coercion.$anonfun$3, org.sodatest.coercion.Coercion.$anonfun$coerceCSV$1, org.sodatest.coercion.Coercion.$anonfun$coerceToJavaEnum$1, org.sodatest.coercion.Coercion.$anonfun$coerceToJavaEnum$2, org.sodatest.coercion.Coercion.$anonfun$coerceToScalaEnum$1, org.sodatest.coercion.Coercion.$anonfun$coerceToScalaEnum$2, org.sodatest.coercion.Coercion.GenericTypeMatcher |
| Methods inherited from class org.sodatest.coercion.CurrencyAmountCoercion |
apply, currencyPatterns, currencyPatterns$default$1, currencyPatterns$default$2, currencyPatterns$default$3, currencyPatterns$default$4, init$default$2, targetClass |
| Methods inherited from class org.sodatest.coercion.Coercion |
coerce, coerce, coerce, coerce$default$3, coerceToClass, coerceToClass$default$3, function2Coercion, resultClass |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CurrencyAmountCoercionForJava
public CurrencyAmountCoercionForJava(Class<T> targetClass)
CurrencyAmountCoercionForJava
public CurrencyAmountCoercionForJava(Class<T> targetClass,
Collection<String> decimalFormatPatterns)
Copyright © 2010-2011 Belmont Technology Pty Ltd. All Rights Reserved.