|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Converter
A converter is a service that can help create specific object types from a string, and vice versa.
The shell is capable of coercing arguments to the their proper type. However, sometimes commands require extra help to do this conversion. This service can implement a converter for a number of types. The command shell will rank these services in order of service.ranking and will then call them until one of the converters succeeds.
| Field Summary | |
|---|---|
static String |
CONVERTER_CLASSES
This property is a string, or array of strings, and defines the classes or interfaces that this converter recognizes. |
static int |
INSPECT
Print the object in detail. |
static int |
LINE
Print the object as a row in a table. |
static int |
PART
Print the value in a small format so that it is identifiable. |
| Method Summary | |
|---|---|
Object |
convert(Class<?> desiredType,
Object in)
Convert an object to the desired type. |
CharSequence |
format(Object target,
int level,
Converter escape)
Convert an objet to a CharSequence object in the requested format. |
| Field Detail |
|---|
static final String CONVERTER_CLASSES
static final int INSPECT
static final int LINE
static final int PART
| Method Detail |
|---|
Object convert(Class<?> desiredType,
Object in)
throws Exception
desiredType - The type that the returned object can be assigned toin - The object that must be converted
Exception
CharSequence format(Object target,
int level,
Converter escape)
throws Exception
target - The object to be converted to a Stringlevel - One of INSPECT, LINE, or PART.escape - Use this object to format sub ordinate objects.
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||