public class TypeConverter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
TypeConverter.Converter
Conversion interface
|
protected class |
TypeConverter.DynamicTwoStageConverter
Support for chaining conversions
|
static class |
TypeConverter.TwoStageConverter
Support for chaining conversions
|
| Constructor and Description |
|---|
TypeConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConverter(java.lang.Class source,
java.lang.Class destination,
TypeConverter.Converter converter)
Add a converter to the list of those available
|
TypeConverter.Converter |
addDynamicTwoStageConverter(java.lang.Class source,
java.lang.Class intermediate,
java.lang.Class destination)
Add a dynamic two stage converter
|
boolean |
booleanValue(java.lang.Object value)
Get the boolean value for the value object
May have conversion failure
|
byte |
byteValue(java.lang.Object value)
Get the byte value for the value object
May have conversion failure
|
char |
charValue(java.lang.Object value)
Get the char value for the value object
May have conversion failure
|
java.util.Collection |
convert(java.lang.Class c,
java.util.Collection values)
General conversion method to convert collection contents to the specified
type.
|
java.lang.Object |
convert(java.lang.Class c,
java.lang.Object value)
General conversion method to Object types (note it cannot support
conversion to primary types due the restrictions of reflection.
|
java.util.Collection |
convert(DataTypeDefinition propertyType,
java.util.Collection values)
General conversion method to convert collection contents to the specified
type.
|
java.lang.Object |
convert(DataTypeDefinition propertyType,
java.lang.Object value)
General conversion method to Object types (note it cannot support
conversion to primary types due the restrictions of reflection.
|
java.util.Collection |
convert(DataTypeDefinition propertyType,
java.lang.Object[] values)
General conversion method to convert collection contents to the specified
type.
|
double |
doubleValue(java.lang.Object value)
Get the bollean value for the value object
May have conversion failure
|
float |
floatValue(java.lang.Object value)
Get the bollean value for the value object
May have conversion failure
|
java.util.Collection |
getCollection(java.lang.Class c,
java.lang.Object value)
Get a collection for the passed value converted to the specified type
|
TypeConverter.Converter |
getConverter(java.lang.Class source,
java.lang.Class dest)
Find a conversion for a specific Class
|
TypeConverter.Converter |
getConverter(java.lang.Object value,
java.lang.Class dest)
Find conversion for the specified object
Note: Takes into account the class of the object and any interfaces it may
also support.
|
java.util.Map |
getConverters() |
int |
intValue(java.lang.Object value)
Get the int value for the value object
May have conversion failure
|
boolean |
isMultiValued(java.lang.Object value)
Is the value multi valued
|
long |
longValue(java.lang.Object value)
Get the long value for the value object
May have conversion failure
|
short |
shortValue(java.lang.Object value)
Get the short value for the value object
May have conversion failure
|
int |
size(java.lang.Object value)
Get the number of values represented
|
public final java.lang.Object convert(DataTypeDefinition propertyType, java.lang.Object value)
propertyType - - the target property typevalue - - the value to be convertedpublic final java.lang.Object convert(java.lang.Class c,
java.lang.Object value)
c - - a class for the target typevalue - - the value to be convertedTypeConversionException - if the conversion cannot be performedpublic final java.util.Collection convert(DataTypeDefinition propertyType, java.lang.Object[] values)
propertyType - - the target property typevalue - - the value to be convertedDictionaryException - if the property type's registered java class is invalidTypeConversionException - if the conversion cannot be performedpublic final java.util.Collection convert(DataTypeDefinition propertyType, java.util.Collection values)
propertyType - - the target property typevalue - - the value to be convertedDictionaryException - if the property type's registered java class is invalidTypeConversionException - if the conversion cannot be performedpublic final java.util.Collection convert(java.lang.Class c,
java.util.Collection values)
c - - a class for the target typevalue - - the collection to be convertedTypeConversionException - if the conversion cannot be performedpublic final boolean booleanValue(java.lang.Object value)
value - public final char charValue(java.lang.Object value)
value - public final byte byteValue(java.lang.Object value)
value - public final short shortValue(java.lang.Object value)
value - public final int intValue(java.lang.Object value)
value - public final long longValue(java.lang.Object value)
value - public final float floatValue(java.lang.Object value)
float - public final double doubleValue(java.lang.Object value)
double - public final boolean isMultiValued(java.lang.Object value)
value - public final int size(java.lang.Object value)
value - public final java.util.Collection getCollection(java.lang.Class c,
java.lang.Object value)
c - value - public final void addConverter(java.lang.Class source,
java.lang.Class destination,
TypeConverter.Converter converter)
source - destination - converter - public final TypeConverter.Converter addDynamicTwoStageConverter(java.lang.Class source, java.lang.Class intermediate, java.lang.Class destination)
source - intermediate - destination - public final TypeConverter.Converter getConverter(java.lang.Object value, java.lang.Class dest)
source - dest - public java.util.Map getConverters()
public TypeConverter.Converter getConverter(java.lang.Class source, java.lang.Class dest)
source - dest - Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.