|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.util.reflect.ClassSyntax
public class ClassSyntax
Provides a syntax for objects by acting as a factory for class and field descriptions.
For a class with fields, ClassSyntax provides the information needed to process instances field-by-field. It also embodies decisions about which fields should be accessible in this way, how their values are obtained or set, and the order in which they should be visited.
It also specifies how low-level objects are represented as Strings and which XML Schema datatype they should have.
A ClassFinder
is used to map both ways between
external names and classes and to map between Java and external
names for classes and fields.
ClassDescr
,
FieldDescr
,
ClassFinder
Field Summary | |
---|---|
protected ClassFinder |
classFinder
|
protected java.util.Map<java.lang.Class,ClassDescr> |
classToDescrCache
|
protected java.util.Map<java.lang.Class,Stringer> |
classToStringerMap
|
Constructor Summary | |
---|---|
ClassSyntax()
|
|
ClassSyntax(ClassFinder finder)
|
Method Summary | ||
---|---|---|
java.lang.Class |
classForExternalName(java.lang.String externalName)
|
|
protected FieldMap |
collectFieldInfo(java.lang.Class objClass)
|
|
protected FieldMap |
collectFields(java.lang.Class c,
FieldMap fields)
Returns an initial List of FieldDescr s. |
|
protected void |
collectRelevantClasses(ClassDescr ftype,
java.util.List result,
java.util.List tail)
|
|
protected void |
collectRelevantClasses(java.lang.Class c,
java.util.List result,
java.util.List tail)
|
|
void |
describeClass(java.lang.Class c)
Prints a description of a class on System.out . |
|
void |
describeClass(java.lang.Class c,
java.io.PrintStream out)
Prints a description of a class on the designated PrintStream. |
|
java.util.List<java.lang.Class> |
expandRelevantClasses(java.util.List<java.lang.Class> topClasses)
Returns a recursively composed list of classes that are related to the classes in the specified list by being the types of fields, etc. |
|
java.lang.String |
externalNameForClass(java.lang.Class c)
|
|
java.lang.String |
externalNameForField(java.lang.String javaName)
|
|
static java.lang.String |
fieldNameFromGetName(java.lang.String name)
|
|
static java.lang.String |
fieldNameFromSetName(java.lang.String name)
|
|
ClassDescr |
getClassDescr(java.lang.Class c)
|
|
ClassFinder |
getClassFinder()
|
|
protected java.lang.reflect.Field[] |
getDeclaredFields(java.lang.Class c)
Returns the class's declared fields, or an empty array if there's a security exception (as there might be in an applet). |
|
protected java.lang.reflect.Method[] |
getDeclaredMethods(java.lang.Class c)
Returns the class's declared methods, or an empty array if there's a security exception (as there might be in an applet). |
|
|
getStringer(java.lang.Class<T> c)
|
|
protected void |
initStringConversions()
|
|
static boolean |
isGetName(java.lang.String name)
|
|
static boolean |
isSetName(java.lang.String name)
|
|
protected boolean |
isWanted(java.lang.reflect.Field f)
|
|
static void |
main(java.lang.String[] argv)
Test loop that repeatedly asks the user for a class name and prints a description. |
|
protected ClassDescr |
makeClassDescr(java.lang.Class c)
|
|
ClassDescr |
makeClassDescr(java.lang.Class collectionClass,
java.lang.Class eltClass)
|
|
ClassDescr |
makeClassDescr(java.lang.Class mapClass,
java.lang.Class keyClass,
java.lang.Class valClass)
|
|
protected FieldDescr |
makeFieldDescr(java.lang.reflect.Field f)
|
|
(package private) FieldMap |
makeFieldDescrs(java.lang.Class c)
Called from a ClassDescr to make descriptions of the class's fields. |
|
protected ClassDescr |
makeFieldTypeDescr(FieldDescr fd,
java.lang.Class fromClass)
Constructs a ClassDescr that describes the value of
a field. |
|
java.util.List<java.lang.Class> |
relevantClasses(java.lang.Class c)
Returns a recursively composed list of classes that are related to the specified class by being the types of fields, etc. |
|
java.util.List<java.lang.Class> |
relevantClasses(java.lang.Class[] topClasses)
Returns a recursively composed list of classes that are related to the classes in the specified array by being the types of fields, etc. |
|
java.util.List<java.lang.Class> |
relevantClasses(java.util.List<java.lang.Class> topClasses)
Returns a recursively composed list of classes that are related to the classes in the specified list by being the types of fields, etc. |
|
protected
|
setStringer(java.lang.Class<T> c,
Stringer<T> s)
|
|
protected void |
tryGetMethod(java.lang.reflect.Method meth,
FieldMap fields)
|
|
protected void |
trySetMethod(java.lang.reflect.Method meth,
FieldMap fields)
|
|
java.lang.String |
upperNameForClass(java.lang.Class c)
|
|
java.lang.String |
xmlSchemaDatatype(java.lang.Class c)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ClassFinder classFinder
protected java.util.Map<java.lang.Class,ClassDescr> classToDescrCache
protected java.util.Map<java.lang.Class,Stringer> classToStringerMap
Constructor Detail |
---|
public ClassSyntax()
public ClassSyntax(ClassFinder finder)
Method Detail |
---|
public ClassFinder getClassFinder()
public java.lang.String externalNameForClass(java.lang.Class c)
public java.lang.Class classForExternalName(java.lang.String externalName)
public java.lang.String externalNameForField(java.lang.String javaName)
public java.lang.String upperNameForClass(java.lang.Class c)
public ClassDescr getClassDescr(java.lang.Class c)
protected ClassDescr makeClassDescr(java.lang.Class c)
public ClassDescr makeClassDescr(java.lang.Class collectionClass, java.lang.Class eltClass)
public ClassDescr makeClassDescr(java.lang.Class mapClass, java.lang.Class keyClass, java.lang.Class valClass)
public java.lang.String xmlSchemaDatatype(java.lang.Class c)
public <T> Stringer<T> getStringer(java.lang.Class<T> c)
protected <T> void setStringer(java.lang.Class<T> c, Stringer<T> s)
protected void initStringConversions()
public java.util.List<java.lang.Class> relevantClasses(java.lang.Class c)
public java.util.List<java.lang.Class> relevantClasses(java.lang.Class[] topClasses)
public java.util.List<java.lang.Class> relevantClasses(java.util.List<java.lang.Class> topClasses)
public java.util.List<java.lang.Class> expandRelevantClasses(java.util.List<java.lang.Class> topClasses)
protected void collectRelevantClasses(java.lang.Class c, java.util.List result, java.util.List tail)
protected void collectRelevantClasses(ClassDescr ftype, java.util.List result, java.util.List tail)
FieldMap makeFieldDescrs(java.lang.Class c)
protected FieldMap collectFieldInfo(java.lang.Class objClass)
protected ClassDescr makeFieldTypeDescr(FieldDescr fd, java.lang.Class fromClass)
ClassDescr
that describes the value of
a field.
protected java.lang.reflect.Method[] getDeclaredMethods(java.lang.Class c)
protected void tryGetMethod(java.lang.reflect.Method meth, FieldMap fields)
protected void trySetMethod(java.lang.reflect.Method meth, FieldMap fields)
public static final boolean isGetName(java.lang.String name)
public static final boolean isSetName(java.lang.String name)
public static final java.lang.String fieldNameFromGetName(java.lang.String name)
public static final java.lang.String fieldNameFromSetName(java.lang.String name)
protected FieldMap collectFields(java.lang.Class c, FieldMap fields)
FieldDescr
s.
protected FieldDescr makeFieldDescr(java.lang.reflect.Field f)
protected java.lang.reflect.Field[] getDeclaredFields(java.lang.Class c)
protected boolean isWanted(java.lang.reflect.Field f)
public void describeClass(java.lang.Class c)
System.out
.
public void describeClass(java.lang.Class c, java.io.PrintStream out)
public static void main(java.lang.String[] argv)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |