|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xlattice.corexml.bind.Join
org.xlattice.corexml.bind.Binding
public abstract class Binding
Superclass for Joins that bind XML element or attribute values to fields in Java objects. The fields are either Java primitives or Strings.
| Field Summary | |
|---|---|
protected int |
argTypeIndex
argument type as index into the list of types above |
static int |
BOOLEAN
boolean field |
static int |
BYTE
|
static int |
CHAR
|
static int |
DOUBLE
|
protected java.lang.String |
fieldName
name of the object field being bound to |
static int |
FLOAT
|
static int |
INT
|
static int |
LONG
|
static int |
SHORT
|
static int |
STRING
String field |
static java.lang.String[] |
TYPES
names of field types, for diagnostic messages |
| Fields inherited from class org.xlattice.corexml.bind.Join |
|---|
ATTRBINDING, clazz, COLLECTOR, EMPTYEL, getter, getterName, INTERFACE, JOIN_TYPES, joined, MAPPING, maxOccur, minOccur, name, setter, setterName, sizer, sizerName, SUBEL, SUBMAPPING, TEXT, UNSPECIFIED |
| Constructor Summary | |
|---|---|
Binding(java.lang.String name)
|
|
Binding(java.lang.String name,
java.lang.String fieldName)
Create a binding between an XML name (tag or attribute name) and a field in an associated class. |
|
| Method Summary | |
|---|---|
protected void |
findMethods(java.lang.Class clazz)
Overrides the method in the superclass, Join. |
protected java.lang.String |
getField(java.lang.Object o)
Get the value of the associated field in a bound object as a String. |
protected static int |
getTypeIndex(java.lang.Class argType)
Given a method argument type learned by reflection, return the index of that type. |
protected void |
join(java.lang.Class clazz)
Method called when the definition of the Mapping is complete. |
Binding |
optional()
The joined element or attribute need not appear in the XML and should not be output if the field has its default value. |
Binding |
repeats()
The joined element may be repeated any number of times. |
protected void |
setField(java.lang.Object o,
java.lang.String value)
Set a field in the bound object to the value passed. |
Binding |
setGetter(java.lang.String g)
Set the unqualified name of the field getter method. |
Binding |
setMaxOccur(int n)
Set the maximum number of times a bound value may occur. |
Binding |
setMinOccur(int n)
Set the minimum number of times a bound value must occur. |
Binding |
setSetter(java.lang.String s)
Set the unqualified name of the field setter method. |
Binding |
setSizer(java.lang.String s)
Set the unqualified name of the sizer method. |
protected static java.lang.String |
typeToString(int i)
|
| Methods inherited from class org.xlattice.corexml.bind.Join |
|---|
_getGetterName, _getSetterName, _getSizerName, _setGetter, _setMaxOccur, _setMinOccur, _setSetter, _setSizer, apply, checkElmJoin, checkJoinObject, checkNameAndState, generate, getClazz, getMaxOccur, getMinOccur, getName, joined, joinType, setClazz, size, tagMatch |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int BOOLEAN
public static final int CHAR
public static final int FLOAT
public static final int DOUBLE
public static final int BYTE
public static final int SHORT
public static final int INT
public static final int LONG
public static final int STRING
public static final java.lang.String[] TYPES
protected final java.lang.String fieldName
protected int argTypeIndex
| Constructor Detail |
|---|
public Binding(java.lang.String name,
java.lang.String fieldName)
name - of an element name (tag) or attribute namefieldName - base name used in field setter/getter methodspublic Binding(java.lang.String name)
| Method Detail |
|---|
public Binding setMaxOccur(int n)
n - maximum number of occurrences
public Binding setMinOccur(int n)
n - minimum number of occurrences
public Binding optional()
public Binding repeats()
public Binding setGetter(java.lang.String g)
g - new name of the getter
public Binding setSetter(java.lang.String s)
s - new name of the setter
public Binding setSizer(java.lang.String s)
s - new name of the setter
protected void join(java.lang.Class clazz)
throws CoreXmlException
join in class Joinclazz - Class involved in the Join
CoreXmlException
protected void findMethods(java.lang.Class clazz)
throws CoreXmlException
findMethods in class JoinCoreXmlException
protected java.lang.String getField(java.lang.Object o)
throws CoreXmlException
o - object involved in this Binding
CoreXmlException
protected void setField(java.lang.Object o,
java.lang.String value)
throws CoreXmlException
o - object that the binding is to be applied tovalue - String value to be set; must be converted
CoreXmlExceptionprotected static final java.lang.String typeToString(int i)
protected static int getTypeIndex(java.lang.Class argType)
argType - learned from reflection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||