| java.lang.Object org.xorm.ClassMapping
ClassMapping | public class ClassMapping implements I15d,Cloneable(Code) | | A ClassMapping provides the mapping from a Java type (class or interface)
to a datastore type. Each field of a Class can map to a Column in
a Table, or may be mapped as a RelationshipMapping.
A ClassMapping is also the repository for default fetch group
information.
|
Method Summary | |
public Object | clone() Creates a shallow clone. | public Column | getColumn(String field) Get the Column mapped to the given field. | public Column | getColumnForMethod(Method method) Convenience method that gets the Column mapped to a particular
get or set method. | public Class | getDatastoreIdentityType() Returns the Class specified as the identity-type for a class mapping,
or null if none was specified. | public DataFetchGroup | getDefaultFetchGroup() | public FieldDescriptor | getFieldDescriptor(String field) Retrieves the FieldDescriptor associated with the given field
name by iterating through the collection of all FieldDescriptors
for this class. | public Collection | getFieldDescriptors() Gets the field descriptors found by introspection on the class
or interface. | public String | getFieldForMethod(Method method) Retrieves the field associated with a get or set method. | public Class | getFieldType(String field) Returns the Java type of the field. | public String | getInverse(String field) | public Set | getManagedFields() Returns the set of managed field names. | public Class | getMappedClass() Get the class that this mapping references. | public Set | getMappedFieldDescriptors() Gets the set of FieldDescriptors that have column mappings defined
in the JDO metadata file. | public RelationshipMapping | getRelationship(String field) Get the relationship mapped to a field. | public RelationshipMapping | getRelationshipForMethod(Method method) Convenience method to go from a get/set method to the
associated relationship mapping. | public Map | getRelationships() Get the map of relationships. | public Table | getTable() Get the table the class is mapped to. | public static boolean | isUserType(Class clazz) Returns true if the class parameter is not a primitive type,
a wrapper class for a primitive type, or java.util.Date,
java.lang.String, java.util.Locale, java.math.BigDecimal,
or java.math.BigInteger. | public void | setColumn(String field, Column column, Boolean inDefaultFetchGroup) Set the Column mapped to the given field. | public void | setDatastoreIdentityType(Class datastoreIdentityType) | public void | setInverse(String localField, String inverseField) | public void | setRelationship(String field, RelationshipMapping relation) Define a to-many relationship on a field. | public void | setTable(Table table) Defines the table that will be used to map the class.
If table is null, defaults will be applied to create a mapping for
the table. |
ClassMapping | public ClassMapping(ModelMapping modelMapping, Class clazz)(Code) | | Creates a new ClassMapping that maps the given Class. The
class will be introspected and assigned relationships for all
properties that are of a user-defined (non-collection) type.
|
getColumn | public Column getColumn(String field)(Code) | | Get the Column mapped to the given field.
|
getColumnForMethod | public Column getColumnForMethod(Method method)(Code) | | Convenience method that gets the Column mapped to a particular
get or set method. Returns null for unmapped methods.
|
getDatastoreIdentityType | public Class getDatastoreIdentityType()(Code) | | Returns the Class specified as the identity-type for a class mapping,
or null if none was specified.
|
getFieldDescriptor | public FieldDescriptor getFieldDescriptor(String field)(Code) | | Retrieves the FieldDescriptor associated with the given field
name by iterating through the collection of all FieldDescriptors
for this class.
exception: JDOUserException - if the named field does not exist. |
getFieldDescriptors | public Collection getFieldDescriptors()(Code) | | Gets the field descriptors found by introspection on the class
or interface. This includes primitive types, user types, and
collection references. The returned items are instances of
org.xorm.FieldDescriptor. Not all fields found by introspection
are required to be mapped.
|
getFieldForMethod | public String getFieldForMethod(Method method)(Code) | | Retrieves the field associated with a get or set method.
Returns null if there is no mapping.
|
getFieldType | public Class getFieldType(String field)(Code) | | Returns the Java type of the field.
|
getManagedFields | public Set getManagedFields()(Code) | | Returns the set of managed field names. This set is the union of
fields that are mapped and fields that are defined as relationships.
|
getMappedClass | public Class getMappedClass()(Code) | | Get the class that this mapping references.
|
getMappedFieldDescriptors | public Set getMappedFieldDescriptors()(Code) | | Gets the set of FieldDescriptors that have column mappings defined
in the JDO metadata file.
|
getRelationship | public RelationshipMapping getRelationship(String field)(Code) | | Get the relationship mapped to a field. If no relationship
exists, returns null.
|
getRelationshipForMethod | public RelationshipMapping getRelationshipForMethod(Method method)(Code) | | Convenience method to go from a get/set method to the
associated relationship mapping.
|
getRelationships | public Map getRelationships()(Code) | | Get the map of relationships. The keys are Strings and the values
are RelationshipMapping objects. A relationship is defined as a
-to-one or -to-many relationship to another first class user object.
|
getTable | public Table getTable()(Code) | | Get the table the class is mapped to.
|
isUserType | public static boolean isUserType(Class clazz)(Code) | | Returns true if the class parameter is not a primitive type,
a wrapper class for a primitive type, or java.util.Date,
java.lang.String, java.util.Locale, java.math.BigDecimal,
or java.math.BigInteger.
|
setColumn | public void setColumn(String field, Column column, Boolean inDefaultFetchGroup)(Code) | | Set the Column mapped to the given field.
exception: JDOUserException - if the field does not exist, or ifthe field has a set() method but the column is marked as read-only. |
setDatastoreIdentityType | public void setDatastoreIdentityType(Class datastoreIdentityType)(Code) | | |
setRelationship | public void setRelationship(String field, RelationshipMapping relation)(Code) | | Define a to-many relationship on a field.
exception: JDOUserException - if the field does not exist |
setTable | public void setTable(Table table)(Code) | | Defines the table that will be used to map the class.
If table is null, defaults will be applied to create a mapping for
the table. This will include a datastore identity column called
"xorm_pk"; other column names will be the same as the field name.
|
|
|