XMLClassDescriptor and XMLFieldDescriptor by Introspection
How are class and field descriptors generated by introspection (in current Castor)?
Which information is put into which attribute?
XMLClassDescriptor
A XMLClassDescriptor instance is created fro every class that has no known standard descriptor.
Attribute |
Filled with |
|---|---|
class |
the class for which mapping is described by this descriptor |
xmlName |
the XML name; either generated from the class name or given a construction |
attributes |
depending on NodeType of field descriptor |
elements |
depending on NodeType of field descriptor |
contentDescriptor |
depending on NodeType of field descriptor |
extends |
a descriptor of a super class is put into the extends attribute and the field descriptors are added from the super class descriptor! |
XMLFieldDescriptor
Fields are either accessibly attributes or special methods (getter, setter, ...) of the class.
Attribute |
Filled with |
|---|---|
fieldName |
the name of the field (taken from the class it is contained) |
fieldType |
the Class of the field; might be set to Object.class |
xmlName |
XML name to use for the field |
nodeType |
the node type to use; default is attribute |
matches |
the xmlName is added to the list of matches used to find matches for XML names |
isWild |
indicates that this field is also used for *; isWild is set if the field type is Object.class |
multivalued |
a flag set to true when the the field is a kind of collection |
fieldHandler |
a FieldHandler instance is created and set |
FieldHandler
In case of pure fields:
Attribute |
Filled with |
|---|---|
field |
the Field |
fieldType |
type of the Field |
fieldName |
is build from field name and type |
immutable |
true if type is immutable |
default |
if type has a defualt value |
convertTo |
TypeConverter instance |
convertFrom |
TypeConverter instance |
collectionHandler |
CollecitonHandler instance |
Out fields identified by methods:
Attribute |
Filled with |
|---|---|
field |
not set |
setMethod or addMethod |
depending on the Method one is filled |
enumMethod or getMethod or iterMethod |
depending on the Method one is filled |
fieldType |
identified type |
fieldName |
is build from fieldName extracted from methods and type |
immutable |
if field type is immutable |
default |
depending on the field type |
convertTo |
TypeConverter instance |
convertFrom |
TypeConverter instance |
collectionHandler |
CollecitonHandler instance |
For collections and date classes some special additional modifications are performed which maybe need to be look at...