|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdx.scorebot.util.translator.TypeTranslator<T,java.lang.String>
cdx.scorebot.util.translator.TranslatorObjectClassName<T>
public class TranslatorObjectClassName<T>
Can translate to an Object of type T from a string. The Object is generated from the string by using a constructor in the class specified by the string (canonical name). The parameters to the constructor are specified by the constructor to this TranslatorObjectClassName class. The string is generated by calling the getClass().getCanonicalName() method of the Object.
Constructor Summary | |
---|---|
TranslatorObjectClassName()
Instantiates a translator (will use T's default constructor) |
|
TranslatorObjectClassName(java.util.AbstractList<java.lang.Object> params)
Instantiates a translator |
|
TranslatorObjectClassName(java.lang.Object o)
Instantiates a translator |
|
TranslatorObjectClassName(java.lang.Object o1,
java.lang.Object o2)
Instantiates a translator |
Method Summary | |
---|---|
java.lang.String |
translate1(T valueToTranslate)
gets the String representation of the specified object T |
T |
translate2(java.lang.String valueToTranslate)
gets the Object representation of the specified String |
Methods inherited from class cdx.scorebot.util.translator.TypeTranslator |
---|
canTranslate1, canTranslate2, getLastException |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TranslatorObjectClassName()
public TranslatorObjectClassName(java.lang.Object o)
o
- object to pass to the T's contructorpublic TranslatorObjectClassName(java.lang.Object o1, java.lang.Object o2)
o1
- first object to pass to the T's contructoro2
- first object to pass to the T's contructorpublic TranslatorObjectClassName(java.util.AbstractList<java.lang.Object> params)
params
- list of values to pass to the T's constructor (if null, then null is added to a new list!)Method Detail |
---|
public java.lang.String translate1(T valueToTranslate)
translate1
in class TypeTranslator<T,java.lang.String>
valueToTranslate
- some object T
public T translate2(java.lang.String valueToTranslate) throws TranslationFailedException
translate2
in class TypeTranslator<T,java.lang.String>
valueToTranslate
- some String
TranslationFailedException
- thrown if the value cannot be translated
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |