|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface is used to convert an object between two given class
Each converter can convert ONLY object of the source class (or subclasses, to support chaining since there are no static types in Java) to the target class
Method Summary | |
java.lang.Object |
convert(java.lang.Object o)
Perform the conversion of the given object to the expected target class, if for some reason the conversion fails (or if the source/target objects do not match the expected classes), an exception should be thrown |
java.lang.Class |
getSourceClass()
Return the Class object the converter expects the source to
be instanceof |
java.lang.Class |
getTargetClass()
Return the Class object the target object will be instanceof |
ScalarConversionWeight |
getWeight()
Return the scalar weight of this converter, if this is a concatenated converter, its weight should include the weight of all of its subconverters |
java.lang.String |
toConversionString()
Return a string representation of the conversion process only, no additional data, this output will be used when ambiguity is detected in order to give the user meaningfull error messages An ambiguity output would be: |
java.lang.String |
toString()
A more programatically meaningfull description of the conversion, it should show at least the weight of the conversion and possibly more data for example: A path conversion string could look like: |
IConverter |
update(IConverter updatedConverter)
This method is used to inform the converter of a new available converter if the new converter affects in any way on the current converter, a new converter that reflects the change should be return. |
Method Detail |
public java.lang.Class getTargetClass()
Class
object the target object will be instanceofClass
public java.lang.Class getSourceClass()
Class
object the converter expects the source to
be instanceofClass
public java.lang.Object convert(java.lang.Object o) throws JParamException
o
- the source object (should be instance of getSourceClass)JParamException
- if for some reason the conversion failedpublic ScalarConversionWeight getWeight()
public java.lang.String toConversionString()
duckling -> duck -> short -> int duckling -> duck -> char -> int
Note that there is no additional text or info here
public java.lang.String toString()
duck --> archduck --> ducky(USER + TO_PARENT)
An ambigous conversion could look like:
AMBIGOUS( duck -> short -> double duck -> uchar -> double)(USER + PROMOTION)
toString
in class java.lang.Object
public IConverter update(IConverter updatedConverter)
updatedConverter
- the newly supported converterthis
if nothing changed or a new
converter representing the change
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |