Search in sources :

Example 1 with StringTranslator

use of org.apache.tapestry5.internal.translator.StringTranslator in project tapestry-5 by apache.

the class TapestryModule method contributeTranslatorSource.

/**
 * Contributes the basic set of translators:
 * <ul>
 * <li>string</li>
 * <li>byte</li>
 * <li>short</li>
 * <li>integer</li>
 * <li>long</li>
 * <li>float</li>
 * <li>double</li>
 * <li>BigInteger</li>
 * <li>BigDecimal</li>
 * </ul>
 */
public static void contributeTranslatorSource(MappedConfiguration<Class, Translator> configuration, NumericTranslatorSupport support, Html5Support html5Support) {
    configuration.add(String.class, new StringTranslator());
    Class[] types = new Class[] { Byte.class, Short.class, Integer.class, Long.class, Float.class, Double.class, BigInteger.class, BigDecimal.class };
    for (Class type : types) {
        String name = type.getSimpleName().toLowerCase();
        configuration.add(type, new NumericTranslator(name, type, support, html5Support));
    }
}
Also used : NumericTranslator(org.apache.tapestry5.internal.translator.NumericTranslator) StringTranslator(org.apache.tapestry5.internal.translator.StringTranslator) BigDecimal(java.math.BigDecimal) BigInteger(java.math.BigInteger) BigInteger(java.math.BigInteger)

Aggregations

BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 NumericTranslator (org.apache.tapestry5.internal.translator.NumericTranslator)1 StringTranslator (org.apache.tapestry5.internal.translator.StringTranslator)1