Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.util.reflect
Class ClassSyntax

    java.lang.Object
      ix.util.reflect.ClassSyntax

    public class ClassSyntax

extends java.lang.Object

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.

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.

See Also:
  `ClassDescr`, `FieldDescr`, `ClassFinder`

Field Summary
`protected ClassFinder` | `classFinder`
`protected java.util.Map` | `classToDescdCache`
`protected java.util.Map` | `classToStringerMap`
`protected TwoKeyHashMap` | `fieldCaseMap`
`protected boolean` | `inferElementClasses`

Constructor Summary
`ClassSyntax()`
`ClassSyntax(ClassFinder finder)`

Method Summary
`java.lang.Class` | `classForExternalName(java.lang.String externalName)`
`protected java.lang.Class` | `classIfExists(java.lang.Class fromClass, java.lang.String className)`
`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` | `expandRelevantClasses(java.util.List 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).
`ClassDescr` | `getFieldCase(java.lang.Class aClass, java.lang.String fieldName)`
`Stringer` | `getStringer(java.lang.Class c)`
`protected void` | `initFieldCases()` Initialize table of field special cases.
`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.String name, java.lang.Class type)`
`(package private) FieldMap` | `makeFieldDescrs(java.lang.Class c)`
`protected ClassDescr` | `makeFieldTypeDescr(FieldDescr fd, java.lang.Class fromClass)` Constructs a `ClassDescr` that describes the value of a field.
`java.util.List` | `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` | `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` | `relevantClasses(java.util.List 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.
`void` | `setFieldCase(java.lang.Class aClass, java.lang.String fieldName, ClassDescr descr)`
`void` | `setInferElementClasses(boolean v)` Sets whether this ClassSyntax is allowed to infer List and Set element classes from field names.
`protected void` | `setStringer(java.lang.Class c, Stringer 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

### classFinder

    protected ClassFinder classFinder

### classToDescdCache

    protected java.util.Map classToDescdCache

### classToStringerMap

    protected java.util.Map classToStringerMap

### inferElementClasses

    protected boolean inferElementClasses

### fieldCaseMap

    protected TwoKeyHashMap fieldCaseMap

Constructor Detail

### ClassSyntax

    public ClassSyntax()

### ClassSyntax

    public ClassSyntax(ClassFinder finder)

Method Detail

### getClassFinder

    public ClassFinder getClassFinder()

### setInferElementClasses

    public void setInferElementClasses(boolean v)

  Sets whether this ClassSyntax is allowed to infer List and Set element classes from field names. For example, if an object has a List field named "refinements", the list's elements might all be instances of a class named "Refinement". This is not necessary, for Lists, when `TypedList`s are used.

### externalNameForClass

    public java.lang.String externalNameForClass(java.lang.Class c)

### classForExternalName

    public java.lang.Class classForExternalName(java.lang.String externalName)

### externalNameForField

    public java.lang.String externalNameForField(java.lang.String javaName)

### upperNameForClass

    public java.lang.String upperNameForClass(java.lang.Class c)

### getClassDescr

    public ClassDescr getClassDescr(java.lang.Class c)

### makeClassDescr

    protected ClassDescr makeClassDescr(java.lang.Class c)

### makeClassDescr

    public ClassDescr makeClassDescr(java.lang.Class collectionClass,
                                     java.lang.Class eltClass)

### makeClassDescr

    public ClassDescr makeClassDescr(java.lang.Class mapClass,
                                     java.lang.Class keyClass,
                                     java.lang.Class valClass)

### xmlSchemaDatatype

    public java.lang.String xmlSchemaDatatype(java.lang.Class c)

### getStringer

    public Stringer getStringer(java.lang.Class c)

### setStringer

    protected void setStringer(java.lang.Class c,
                               Stringer s)

### initStringConversions

    protected void initStringConversions()

### relevantClasses

    public java.util.List 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.

### relevantClasses

    public java.util.List 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.

### relevantClasses

    public java.util.List relevantClasses(java.util.List 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.

### expandRelevantClasses

    public java.util.List expandRelevantClasses(java.util.List 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. This method retains the order of the original list, but does preorder expansion of elements to include any relevant classes not already there.

### collectRelevantClasses

    protected void collectRelevantClasses(java.lang.Class c,
                                          java.util.List result,
                                          java.util.List tail)

### collectRelevantClasses

    protected void collectRelevantClasses(ClassDescr ftype,
                                          java.util.List result,
                                          java.util.List tail)

### makeFieldDescrs

    FieldMap makeFieldDescrs(java.lang.Class c)

### makeFieldDescr

    protected FieldDescr makeFieldDescr(java.lang.String name,
                                        java.lang.Class type)

### initFieldCases

    protected void initFieldCases()

  Initialize table of field special cases.

### getFieldCase

    public ClassDescr getFieldCase(java.lang.Class aClass,
                                   java.lang.String fieldName)

### setFieldCase

    public void setFieldCase(java.lang.Class aClass,
                             java.lang.String fieldName,
                             ClassDescr descr)

### collectFieldInfo

    protected FieldMap collectFieldInfo(java.lang.Class objClass)

### getDeclaredMethods

    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).

### makeFieldTypeDescr

    protected ClassDescr makeFieldTypeDescr(FieldDescr fd,
                                            java.lang.Class fromClass)

  Constructs a `ClassDescr` that describes the value of a field.

  See Also:
    `getFieldCase(Class, String)`, `setFieldCase(Class, String, ClassDescr)`

### classIfExists

    protected java.lang.Class classIfExists(java.lang.Class fromClass,
                                            java.lang.String className)

### tryGetMethod

    protected void tryGetMethod(java.lang.reflect.Method meth,
                                FieldMap fields)

### trySetMethod

    protected void trySetMethod(java.lang.reflect.Method meth,
                                FieldMap fields)

### isGetName

    public static final boolean isGetName(java.lang.String name)

### isSetName

    public static final boolean isSetName(java.lang.String name)

### fieldNameFromGetName

    public static final java.lang.String fieldNameFromGetName(java.lang.String name)

### fieldNameFromSetName

    public static final java.lang.String fieldNameFromSetName(java.lang.String name)

### collectFields

    protected FieldMap collectFields(java.lang.Class c,
                                     FieldMap fields)

  Returns an initial List of `FieldDescr`s.

### getDeclaredFields

    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).

### isWanted

    protected boolean isWanted(java.lang.reflect.Field f)

### describeClass

    public void describeClass(java.lang.Class c)

  Prints a description of a class on `System.out`.

### describeClass

    public void describeClass(java.lang.Class c,
                              java.io.PrintStream out)

  Prints a description of a class on the designated PrintStream.

### main

    public static void main(java.lang.String[] argv)

  Test loop that repeatedly asks the user for a class name and prints a description.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD