|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.service.cmr.repository.datatype.TypeConverter
public class TypeConverter
Support for generic conversion between types. Additional conversions may be added. Direct conversion and two stage conversions via Number are supported. We do not support conversion by any route at the moment
Nested Class Summary | |
---|---|
static interface |
TypeConverter.Converter
Conversion interface |
protected class |
TypeConverter.DynamicTwoStageConverter
Support for chaining conversions |
static class |
TypeConverter.TwoStageConverter
Support for chaining conversions |
Constructor Summary | |
---|---|
TypeConverter()
|
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeConverter()
Method Detail |
---|
public final java.lang.Object convert(DataTypeDefinition propertyType, java.lang.Object value)
propertyType
- - the target property typevalue
- - the value to be converted
public final java.lang.Object convert(java.lang.Class c, java.lang.Object value)
c
- - a class for the target typevalue
- - the value to be converted
TypeConversionException
- 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 converted
DictionaryException
- if the property type's registered java class is invalid
TypeConversionException
- 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 converted
DictionaryException
- if the property type's registered java class is invalid
TypeConversionException
- 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 converted
TypeConversionException
- 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
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |