|
Jetif v1.8.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjetif.Handler
The handler is used to convert a string value to an object instance.
This class defines the mechanism for object conversion, the implementation
of a handler should implements the toObject(...) and
reusable() at least.
| Constructor Summary | |
Handler()
|
|
| Method Summary | |
String |
getProperty(String key)
This method allows custom handler to access the properties of current suite. |
String |
getProperty(String key,
String defaultValue)
This method allows custom handler to access the properties of current suite. |
protected boolean |
isInstanceClass(Class type)
Test if the specified class is an instance class. |
boolean |
matches(String value,
String type,
Object obj)
Indicate an object matches the expected value. |
abstract boolean |
reusable()
Indicate that if this handler can be reuse for different object. |
void |
setProperties(Properties props)
Set the suite properties for this handler. |
boolean |
supports(String type,
Class clazz)
Test if a type can be converted to specified class with this handler. |
abstract Object |
toObject(String value,
String type,
Class clazz)
Convert a string value to object of specified class. |
String |
toString(Object obj)
Convert a result object to string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Handler()
| Method Detail |
public abstract Object toObject(String value,
String type,
Class clazz)
throws UnsupportedTypeException,
ConversionException
value - the string value to be converted.type - the desired type in spec, it may be a derived class
of the target class, and will be null if it's not defined.clazz - the specified type of object.
UnsupportedTypeException - occurs if the desired class not supported
by this handler.
ConversionException - error occurs when convert the object.
public boolean supports(String type,
Class clazz)
type - the desired type in spec, it may be a derived class of
target class, and will be null if undefined.clazz - the target class.
public boolean matches(String value,
String type,
Object obj)
value - the expected value.type - the desired type in spec.obj - the object to be tested.
public abstract boolean reusable()
public String toString(Object obj)
MethodResult.getActual().
obj - the object to be converted.
MethodResult.getActual()public String getProperty(String key)
key - the key of the property
public String getProperty(String key,
String defaultValue)
key - the key of the propertydefaultValue - the default value of the property
public final void setProperties(Properties props)
props - the suite properties.protected boolean isInstanceClass(Class type)
type - the class type.
|
Jetif v1.8.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||