Package net.ontopia.persistence.proxy
Class FieldDescriptor
- java.lang.Object
-
- net.ontopia.persistence.proxy.FieldDescriptor
-
public class FieldDescriptor extends Object
INTERNAL: Class used for holding object relational mapping field declarations. It is used by the ObjectRelationalMapping class.A field descriptor contains information about fields of object classes defined in object relational mappings. A field descriptor belongs to a single class descriptor.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
cardinality
protected ClassDescriptor
cdesc
protected Class
collection_class
protected String[]
columns
protected String
getter
protected Method
getter_method
protected String[]
joinkeys
protected String
jointable
static int
MANY_TO_MANY
Flag indicating that the descriptor field represents a M:M relationship.protected String[]
manykeys
protected ObjectRelationalMapping
mapping
protected String
name
static int
ONE_TO_MANY
Flag indicating that the descriptor field represents a 1:M relationship.static int
ONE_TO_ONE
Flag indicating that the descriptor field represents a 1:1 relationship.protected boolean
readonly
protected boolean
required
protected String
setter
protected Method
setter_method
protected Class
value_class
-
Constructor Summary
Constructors Constructor Description FieldDescriptor(String name, ClassDescriptor cdesc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCardinality()
INTERNAL: Gets the field cardinality.ClassDescriptor
getClassDescriptor()
INTERNAL: Gets the class descriptor that the field descriptor belongs to.Class
getCollectionClass()
INTERNAL: Returns the collection class to store the field values in if the field is a 1:M and M:M field.String[]
getColumns()
INTERNAL: Returns the names of the columns referenced by the field.String
getGetter()
INTERNAL: Returns the method name for getting the field value from class instances.Method
getGetterMethod()
INTERNAL: Returns the method for getting the field value from class instances.String[]
getJoinKeys()
INTERNAL: Gets the columns that contains the keys referencing the master table.String
getJoinTable()
INTERNAL: Gets the name of the table which needs to be joined to order to access the field via the master table.String[]
getManyKeys()
INTERNAL: Gets the columns that contains the keys in the jointable that references the field table.String
getName()
INTERNAL: Returns the name of the descriptor field (the mapped field).String
getSetter()
INTERNAL: Returns the method name for setting the field value of class instances.Method
getSetterMethod()
INTERNAL: Returns the method for setting the field value of class instances.String
getTable()
INTERNAL: Returns the name of the table in which the field is stored.Class
getValueClass()
INTERNAL: Gets the field value class.ClassDescriptor
getValueClassDescriptor()
INTERNAL: Gets the class descriptor of the field value class.boolean
isAggregateField()
INTERNAL: Returns true if the field is an aggregate field.boolean
isCollectionField()
INTERNAL: Returns true if the field is a collection field (a cardinality of 1:1 or 1:M).boolean
isExternal()
INTERNAL: Returns true if the field is stored in a different table from the master table.boolean
isIdentityField()
INTERNAL: Returns true if the field is an identity field.boolean
isManyToMany()
INTERNAL: Returns true if the field cardinality is M:M.boolean
isOneToMany()
INTERNAL: Returns true if the field cardinality is 1:M.boolean
isOneToOne()
INTERNAL: Returns true if the field cardinality is 1:1.boolean
isPrimitiveField()
INTERNAL: Returns true if the field is a primitive field.boolean
isReadOnly()
INTERNAL: Returns true if this field is read-only field.boolean
isReferenceField()
INTERNAL: Returns true if the field is a reference field.boolean
isRequired()
INTERNAL: Returns true if the field is a required field.void
setCardinality(int cardinality)
INTERNAL: Sets the field cardinality.void
setCollectionClass(Class collection_class)
INTERNAL: Sets the collection class to store the field values in if the field is a 1:M and M:M field.void
setColumns(String[] columns)
INTERNAL: Sets the names of the columns referenced by the field.void
setGetter(String getter)
INTERNAL: Sets the method name for getting the field value from class instances.void
setGetterMethod(Method getter_method)
INTERNAL: Sets the method for getting the field value from class instances.void
setJoinKeys(String[] joinkeys)
INTERNAL: Sets the columns that contains the keys referencing the master table.void
setJoinTable(String jointable)
INTERNAL: Sets the name of the table which needs to be joined to order to access the field via the master table.void
setManyKeys(String[] manykeys)
INTERNAL: Sets the columns that contains the keys in the jointable that references the field table.void
setReadOnly(boolean readonly)
INTERNAL: Sets whether the field is a read-only field or not.void
setRequired(boolean required)
INTERNAL: Sets whether the field is a required field or not.void
setSetter(String setter)
INTERNAL: Sets the method name for setting the field value of class instances.void
setSetterMethod(Method setter_method)
INTERNAL: Sets the method for setting the field value of class instances.void
setValueClass(Class value_class)
INTERNAL: Sets the field value class.String
toString()
-
-
-
Field Detail
-
ONE_TO_ONE
public static final int ONE_TO_ONE
Flag indicating that the descriptor field represents a 1:1 relationship.- See Also:
- Constant Field Values
-
ONE_TO_MANY
public static final int ONE_TO_MANY
Flag indicating that the descriptor field represents a 1:M relationship.- See Also:
- Constant Field Values
-
MANY_TO_MANY
public static final int MANY_TO_MANY
Flag indicating that the descriptor field represents a M:M relationship.- See Also:
- Constant Field Values
-
mapping
protected ObjectRelationalMapping mapping
-
cdesc
protected ClassDescriptor cdesc
-
name
protected String name
-
cardinality
protected int cardinality
-
value_class
protected Class value_class
-
required
protected boolean required
-
readonly
protected boolean readonly
-
getter
protected String getter
-
setter
protected String setter
-
getter_method
protected Method getter_method
-
setter_method
protected Method setter_method
-
columns
protected String[] columns
-
jointable
protected String jointable
-
joinkeys
protected String[] joinkeys
-
manykeys
protected String[] manykeys
-
collection_class
protected Class collection_class
-
-
Constructor Detail
-
FieldDescriptor
public FieldDescriptor(String name, ClassDescriptor cdesc)
-
-
Method Detail
-
getClassDescriptor
public ClassDescriptor getClassDescriptor()
INTERNAL: Gets the class descriptor that the field descriptor belongs to.
-
getName
public String getName()
INTERNAL: Returns the name of the descriptor field (the mapped field).
-
getCardinality
public int getCardinality()
INTERNAL: Gets the field cardinality.
-
setCardinality
public void setCardinality(int cardinality)
INTERNAL: Sets the field cardinality. This can be either ONE_TO_ONE, ONE_TO_MANY or MANY_TO_MANY.
-
isOneToOne
public boolean isOneToOne()
INTERNAL: Returns true if the field cardinality is 1:1.
-
isOneToMany
public boolean isOneToMany()
INTERNAL: Returns true if the field cardinality is 1:M.
-
isManyToMany
public boolean isManyToMany()
INTERNAL: Returns true if the field cardinality is M:M.
-
isCollectionField
public boolean isCollectionField()
INTERNAL: Returns true if the field is a collection field (a cardinality of 1:1 or 1:M).
-
isRequired
public boolean isRequired()
INTERNAL: Returns true if the field is a required field.
-
setRequired
public void setRequired(boolean required)
INTERNAL: Sets whether the field is a required field or not.
-
isReadOnly
public boolean isReadOnly()
INTERNAL: Returns true if this field is read-only field.
-
setReadOnly
public void setReadOnly(boolean readonly)
INTERNAL: Sets whether the field is a read-only field or not.
-
getValueClassDescriptor
public ClassDescriptor getValueClassDescriptor()
INTERNAL: Gets the class descriptor of the field value class. Note that primitive value classes don't have a class info.
-
getValueClass
public Class getValueClass()
INTERNAL: Gets the field value class. For primitive fields the primitive wrapper class is returned.
-
setValueClass
public void setValueClass(Class value_class)
INTERNAL: Sets the field value class. For primitive fields the primitive wrapper class should be used.
-
isIdentityField
public boolean isIdentityField()
INTERNAL: Returns true if the field is an identity field.
-
isPrimitiveField
public boolean isPrimitiveField()
INTERNAL: Returns true if the field is a primitive field.
-
isReferenceField
public boolean isReferenceField()
INTERNAL: Returns true if the field is a reference field.
-
isAggregateField
public boolean isAggregateField()
INTERNAL: Returns true if the field is an aggregate field.
-
getGetter
public String getGetter()
INTERNAL: Returns the method name for getting the field value from class instances.
-
setGetter
public void setGetter(String getter)
INTERNAL: Sets the method name for getting the field value from class instances.
-
getSetter
public String getSetter()
INTERNAL: Returns the method name for setting the field value of class instances.
-
setSetter
public void setSetter(String setter)
INTERNAL: Sets the method name for setting the field value of class instances.
-
getGetterMethod
public Method getGetterMethod()
INTERNAL: Returns the method for getting the field value from class instances.
-
setGetterMethod
public void setGetterMethod(Method getter_method)
INTERNAL: Sets the method for getting the field value from class instances.
-
getSetterMethod
public Method getSetterMethod()
INTERNAL: Returns the method for setting the field value of class instances.
-
setSetterMethod
public void setSetterMethod(Method setter_method)
INTERNAL: Sets the method for setting the field value of class instances.
-
getTable
public String getTable()
INTERNAL: Returns the name of the table in which the field is stored.
-
isExternal
public boolean isExternal()
INTERNAL: Returns true if the field is stored in a different table from the master table.
-
getColumns
public String[] getColumns()
INTERNAL: Returns the names of the columns referenced by the field.
-
setColumns
public void setColumns(String[] columns)
INTERNAL: Sets the names of the columns referenced by the field.
-
getJoinTable
public String getJoinTable()
INTERNAL: Gets the name of the table which needs to be joined to order to access the field via the master table.
-
setJoinTable
public void setJoinTable(String jointable)
INTERNAL: Sets the name of the table which needs to be joined to order to access the field via the master table.
-
getJoinKeys
public String[] getJoinKeys()
INTERNAL: Gets the columns that contains the keys referencing the master table.
-
setJoinKeys
public void setJoinKeys(String[] joinkeys)
INTERNAL: Sets the columns that contains the keys referencing the master table.
-
getManyKeys
public String[] getManyKeys()
INTERNAL: Gets the columns that contains the keys in the jointable that references the field table.
-
setManyKeys
public void setManyKeys(String[] manykeys)
INTERNAL: Sets the columns that contains the keys in the jointable that references the field table.
-
getCollectionClass
public Class getCollectionClass()
INTERNAL: Returns the collection class to store the field values in if the field is a 1:M and M:M field.
-
setCollectionClass
public void setCollectionClass(Class collection_class)
INTERNAL: Sets the collection class to store the field values in if the field is a 1:M and M:M field.
-
-