Package org.scopemvc.util.convertor

This package contains an extensible mechanism used to convert arbitrary types to and from a String representation.


Interface Summary
StringConvertor Specifies contract for all classes converting object values to String representation and back from String into object instances.

Class Summary
BigDecimalStringConvertor String convertor for type BigDecimal.
BigIntegerStringConvertor String convertor for type BigInteger.
BooleanStringConvertor String convertor for type java.util.Date.
DateStringConvertor String convertor for type java.util.Date.
DateTimeStringConvertor String convertor for type DateTime or java.util.Date .
DoubleStringConvertor String convertor for type java.lang.Double.
FloatStringConvertor String convertor for type java.lang.Float.
IntegerStringConvertor String convertor for type java.lang.Integer.
LongStringConvertor String convertor for type java.lang.Long.
NullStringConvertor Abstract base class for StringConvertors that recognise a presetn String value to represent null.
NumberStringConvertor Abstract base class for numeric StringConvertors.
StringConvertors Factory class for creation of default convertors for arbitrary classes.
StringStringConvertor String convertor for type java.lang.String.
TimeStringConvertor String convertor for type Time or java.util.Date .

Package org.scopemvc.util.convertor Description

This package contains an extensible mechanism used to convert arbitrary types to and from a String representation.


When presenting model properties to the user it is often necessary to convert native datatypes to a String representation. For example, is an STextField is used to edit a Float property, the Float must be convertible to and from a String.

This work is done by StringConvertor classes created by StringConvertors.forClass.

A StringConvertor is type-specific, for example FloatStringConvertor, and has two methods: valueAsString and stringAsValue, both of which throw IllegalArgumentException if the conversion fails.

The factory is configured using ScopeConfig so that custom convertors can be registered in application-specific configuration (see ScopeConfig.setPropertiesName(java.lang.String)).

Note that DateTimeStringConvertor is associated with the DateTime datatype (an empty/marker subclass of java.util.Date), and TimeStringConvertor is associated with the Time datatype (an empty/marker subclass of java.util.Date).

Copyright © 2000-2002 The Scope Team. All Rights Reserved.