The i18n module contains useful i18n converters implementations.
Users that want to use the Format module, have to add the following dependency in the pom.xml:
<dependency> <groupId>org.apache.onami.converters</groupId> <artifactId>org.apache.onami.converters.i18n</artifactId> <version>1.0.1-SNAPSHOT</version> <scope>compile</scope> </dependency>
Is the converter that converts a java.lang.String representation to a java.util.Currency.
Is the converter that converts a java.lang.String representation to a java.util.Calendar and to java.util.Date.
By default, this converter manages the following ISO Date format representation:
If users need to add new supported date formats, first they have to retrieve the DateConverter, then add a new pattern:
DateConverter dateConverter = module.lookup( Date.class, DateConverter.class ); dateConverter.addPattern( "EEE, MMM d, ''yy" );
If users need to set the java.util.Locale and/or the java.util.TimeZone, first they have to retrieve the DateConverter, then set their preferences:
import java.util.Locale; import java.util.TimeZone; ... DateConverter dateConverter = module.lookup( Date.class, DateConverter.class ); dateConverter.setLocale( Locale.getDefault() ); dateConverter.setTimeZone( TimeZone.getDefault() );