| Package | com.yworks.support |
| Class | public class TypeConverters |
| Inheritance | TypeConverters Object |
Class types to implementations of ITypeConverter for
these Class types.
Per default, ITypeConverters for int, uint, Number, Boolean and
String are registered which can convert objects of these types to and from Strings.
See also
| Method | Defined By | ||
|---|---|---|---|
getTypeConverter(type:Class):ITypeConverter [static]
An ITypeConverter for the given type is looked up and returned. | TypeConverters | ||
setTypeConverter(type:Class, converter:ITypeConverter):void [static]
Sets a TypeConverter for the given class type. | TypeConverters | ||
| getTypeConverter | () | method |
public static function getTypeConverter(type:Class):ITypeConverter
An ITypeConverter for the given type is looked up and returned.
This is done in two steps:
Step one is to check whether an apropriate ITypeConverter has been
added via the setTypeConverter method and to return it in this case.
If no ITypeConverter can be found this way, step two is to check the
given Class for a meta data tag with the name 'TypeConverter', which's
type attribute holds the full name of an ITypeConverter able to handle
this Class. If such a tag can be found, an instance of this ITypeConverter
is created, registered via the setTypeConverter method and returned.
When using such a tag for a custom ITypeConverter one has to assure
that this ITypeConverter class won't be omitted by the compiler by either
having a reference to an instance or the class object of this type or
by forcing the compiler not to omit it with a tag like:
-includes myPacket.MyCustomTypeConverterIf no
ITypeConverter can be found by one of the two ways, null is returned.
Parameters
type:Class — The Class for which an ITypeConverter should be looked up.
|
ITypeConverter — An ITypeConverter for the given class type or null if no such
TypeConverter can be found.
|
See also
| setTypeConverter | () | method |
public static function setTypeConverter(type:Class, converter:ITypeConverter):void
Sets a TypeConverter for the given class type.
Parameters
type:Class — The Class which the given converter can handle.
| |
converter:ITypeConverter — The TypeConverter to handle objects of the given class
|