|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TypeWrapper
Encapsulates information about a parameter's value type and how values should be converted between strings and the appropriate object instances.
This allows elimination of an additional "evil" if-elseif...else" pattern.
Field Summary | |
---|---|
static String |
FAILED_TO_CONVERT
Error message for failed to convert 1/2. |
static String |
TO
Error message for failed to convert 2/2. |
Method Summary | |
---|---|
Object |
fromString(String value)
Attempts to convert a parameter value expressed as string into an instance of the appropriate (for this parameter) type. |
Class<?> |
getValueType()
|
String |
toString(Object value)
Attempts to convert a parameter value expressed as an object of the appropriate (for this parameter) type into a string representation. |
boolean |
valid(Object o)
Checks if the object is of a valid type for this type info. |
Field Detail |
---|
static final String FAILED_TO_CONVERT
static final String TO
Method Detail |
---|
Class<?> getValueType()
boolean valid(Object o)
o
- the object to check
Object fromString(String value)
value
- parameter value as string
String toString(Object value)
value
- parameter value as object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |