|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.introspection.DataFormatter
public class DataFormatter
This class helps create String representations of given objects using introspection. It also contains some methods that facilitate String manipulation.
Constructor Summary | |
---|---|
DataFormatter()
|
Method Summary | |
---|---|
static java.lang.String |
arrayToString(java.lang.Object array)
Returns a default String representation of an array. |
static java.lang.String |
arrayToString(java.lang.Object array,
java.lang.String lineStart)
Returns a String representation of an array with the specified text in the beginning of each line. |
static java.lang.Object[] |
convertPrimitiveArray(java.lang.Object value)
Converts an array of primitive values into Java wrappers. |
static int |
getLineCount(java.lang.String lines)
Returns number of lines (separated by \n) contained in the given String. |
static java.lang.String[] |
splitStringByLines(java.lang.String stringToSplit)
Splits a given string into multiple strings, each containing a single line (separated by \n) |
static java.lang.String[] |
splitStringOnCapitals(java.lang.String stringToSplit)
|
static java.lang.String |
toString(java.lang.Class aClass)
Returns short name of the given Class object. |
static java.lang.String |
toString(java.lang.Class[] array)
Returns a String representing an array of Class objects, separated by "," |
static java.lang.String |
toString(java.lang.reflect.Constructor aConstructor,
boolean showParameters)
Returns a String representation of a constructor. |
static java.lang.String |
toString(java.lang.reflect.Field aField)
Returns a String representation of the given field, showing its type and its name. |
static java.lang.String |
toString(java.lang.reflect.Field aField,
boolean showType)
Returns a String representation of the given field, showing its type iff the showType parameter is set to true. |
static java.lang.String |
toString(java.lang.reflect.Member aMember)
Returns a String representation of the specified member, and its return and parameter types. |
static java.lang.String |
toString(java.lang.reflect.Member aMember,
boolean showType,
boolean showParameters)
Returns a String representation of the specified member, and its return and parameter types only if specified so by the showType and showParameters flags. |
static java.lang.String |
toString(java.lang.reflect.Method aMethod)
Returns a String representation of the given method, showing also its type and parameter types. |
static java.lang.String |
toString(java.lang.reflect.Method aMethod,
boolean showType,
boolean showParameters)
Returns a String representation of the given method, showing also its type and parameter types iff specified. |
static java.lang.String[] |
toStringArray(java.lang.Class[] array)
Returns an array of String representations of Class objects contained in the given array. |
static java.lang.String[] |
toStringArray(java.beans.FeatureDescriptor[] array,
boolean showType,
boolean showParameters)
Returns an array of String representations of feature descriptors in the given array. |
static java.lang.String[] |
toStringArray(java.lang.reflect.Member[] array,
boolean showType,
boolean showParameters)
Returns an array of String representations of members in the given array. |
static java.lang.String[] |
toStringArray(java.lang.Object[] array)
Returns an array of String representations of objects in the given array. |
static java.lang.String |
unpackArray(java.lang.Object array)
Creates a default String representation of an array. |
static java.lang.String |
unpackArray(java.lang.Object array,
java.lang.String lineStart)
Creates a String representation of an array, putting the passed lineStart at the beginning of each line. |
static java.lang.String |
unpackArray(java.lang.Object array,
java.lang.String lineStart,
int level)
Creates a String representation of an array, putting the passed lineStart at the beginning of each line. |
static java.lang.String |
unpackReturnValue(java.lang.Object value,
java.lang.String start,
int level)
Uses introspection to unpack any type of return value operations might return. |
static java.lang.String |
unpackReturnValue(java.lang.Object value,
java.lang.String start,
int level,
boolean expand)
Uses introspection to unpack any type of return value operations might return. |
static java.lang.String |
unpackValues(java.lang.String[] names,
java.lang.Object[] values)
Unpacks the given values and creates their String representations. |
static java.lang.String |
unpackValues(java.lang.String[] names,
java.lang.Object[] values,
java.lang.String delimiter)
Unpacks the given values and creates their String representations. |
static java.lang.String |
unpackValues(java.lang.String[] names,
java.lang.Object[] values,
java.lang.String delimiter,
boolean expand)
Unpacks the given values and creates their String representations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataFormatter()
Method Detail |
---|
public static java.lang.String toString(java.lang.Class aClass)
aClass
- Class
public static java.lang.String toString(java.lang.Class[] array)
array
- Class[]
public static java.lang.String toString(java.lang.reflect.Constructor aConstructor, boolean showParameters)
aConstructor
- ConstructorshowParameters
- boolean
public static java.lang.String toString(java.lang.reflect.Field aField)
aField
- Field
public static java.lang.String toString(java.lang.reflect.Field aField, boolean showType)
aField
- FieldshowType
- boolean
public static java.lang.String toString(java.lang.reflect.Member aMember)
aMember
- Member
public static java.lang.String toString(java.lang.reflect.Member aMember, boolean showType, boolean showParameters)
aMember
- MembershowType
- booleanshowParameters
- boolean
public static java.lang.String toString(java.lang.reflect.Method aMethod)
aMethod
- Method
public static java.lang.String toString(java.lang.reflect.Method aMethod, boolean showType, boolean showParameters)
aMethod
- MethodshowType
- booleanshowParameters
- boolean
public static java.lang.String[] toStringArray(java.lang.Class[] array)
array
- Class[]
public static java.lang.String[] toStringArray(java.lang.reflect.Member[] array, boolean showType, boolean showParameters)
array
- Member[]showType
- booleanshowParameters
- boolean
public static java.lang.String[] toStringArray(java.beans.FeatureDescriptor[] array, boolean showType, boolean showParameters)
array
- FeatureDescriptor[]showType
- booleanshowParameters
- boolean
public static java.lang.String[] toStringArray(java.lang.Object[] array)
array
- Object[]
public static java.lang.String arrayToString(java.lang.Object array)
array
- java.lang.Object
public static java.lang.String arrayToString(java.lang.Object array, java.lang.String lineStart)
array
- java.lang.ObjectlineStart
- java.lang.String
public static java.lang.Object[] convertPrimitiveArray(java.lang.Object value)
value
- Object
public static int getLineCount(java.lang.String lines)
lines
- java.lang.String
public static java.lang.String[] splitStringByLines(java.lang.String stringToSplit)
stringToSplit
- String
public static java.lang.String[] splitStringOnCapitals(java.lang.String stringToSplit)
public static java.lang.String unpackArray(java.lang.Object array)
array
- java.lang.Object
public static java.lang.String unpackArray(java.lang.Object array, java.lang.String lineStart)
array
- java.lang.ObjectlineStart
- java.lang.String
public static java.lang.String unpackArray(java.lang.Object array, java.lang.String lineStart, int level)
array
- java.lang.ObjectlineStart
- java.lang.Stringlevel
- int
public static java.lang.String unpackReturnValue(java.lang.Object value, java.lang.String start, int level)
value
- Objectstart
- Stringlevel
- int
public static java.lang.String unpackReturnValue(java.lang.Object value, java.lang.String start, int level, boolean expand)
value
- Objectstart
- Stringlevel
- intexpand
- boolean
public static java.lang.String unpackValues(java.lang.String[] names, java.lang.Object[] values)
names
- java.lang.String[]values
- java.lang.Object[]
public static java.lang.String unpackValues(java.lang.String[] names, java.lang.Object[] values, java.lang.String delimiter)
names
- java.lang.String[]values
- java.lang.Object[]delimiter
- String
public static java.lang.String unpackValues(java.lang.String[] names, java.lang.Object[] values, java.lang.String delimiter, boolean expand)
names
- java.lang.String[]values
- java.lang.Object[]delimiter
- Stringexpand
- boolean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |