Package net.ontopia.persistence.proxy
Class IdentityFieldInfo
- java.lang.Object
-
- net.ontopia.persistence.proxy.IdentityFieldInfo
-
- All Implemented Interfaces:
FieldHandlerIF
,FieldInfoIF
public class IdentityFieldInfo extends Object implements FieldInfoIF
INTERNAL: A field that represents the identity of instances of a class. An identity field is a composite of one or more fields that together represent the identity of objects.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
column_count
protected FieldInfoIF[]
fields
protected int
fields_length
protected Method
getter
protected ClassInfoIF
parent_cinfo
protected Class<?>
parent_class
protected Method
setter
protected int
sqlType
protected String[]
value_columns
-
Fields inherited from interface net.ontopia.persistence.proxy.FieldInfoIF
MANY_TO_MANY, ONE_TO_MANY, ONE_TO_ONE
-
-
Constructor Summary
Constructors Constructor Description IdentityFieldInfo(ClassInfoIF parent_cinfo, FieldInfoIF[] identity_fields)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
aggregateColumnNames(List<String> columns)
void
bind(Object value, PreparedStatement stm, int stmt_index)
INTERNAL: Binds the identity keys to the containing fields.protected String[]
computeValueColumns()
int
getCardinality()
INTERNAL: Gets the field cardinality.int
getColumnCount()
INTERNAL: Returns the number of columns that the field spans.FieldInfoIF[]
getFieldInfos()
INTERNAL: Returns the underlying FieldInfoIF instances.FieldInfoIF[]
getFields()
INTERNAL: Returns the underlying FieldInfoIFs that the identity field spans.int
getIndex()
INTERNAL: Gets the value field index of this field.String[]
getJoinKeys()
INTERNAL: Gets the columns in the join table that contains the keys of the referencing object.String
getJoinTable()
INTERNAL: Gets the name of the table which needs to be joined to order to access the field value from the master table.String[]
getManyKeys()
INTERNAL: Gets the columns in the join table that contains the keys of the referenced object.String
getName()
INTERNAL: Gets the field name.ClassInfoIF
getParentClassInfo()
INTERNAL: Gets the class info for the field's object type.String
getTable()
INTERNAL: Gets the table in which the field value is stored (aka the master table).Object
getValue(Object object)
INTERNAL: Gets the field value from the given object.Class<?>
getValueClass()
INTERNAL: Gets the field value class.ClassInfoIF
getValueClassInfo()
INTERNAL: Gets the class info for the field's value type.String[]
getValueColumns()
INTERNAL: Returns the names of the columns that the field spans.boolean
isAggregateField()
INTERNAL: Returns true if the field is an aggregate field.boolean
isCollectionField()
INTERNAL: Returns true if the field is a collection field (has a cardinality of 1:1 or 1:M).boolean
isIdentityField()
INTERNAL: Returns true if the field handler references an object identity field.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.Object
load(AccessRegistrarIF registrar, TicketIF ticket, ResultSet rs, int rsindex, boolean direct)
INTERNAL: Loads from its containing fields an IdentityIF with the field values as key.void
retrieveFieldValues(Object value, List<Object> field_values)
void
retrieveSQLValues(Object value, List<SQLValueIF> sql_values)
void
setValue(Object object, Object value)
INTERNAL: Sets the field value for the given object.String
toString()
-
-
-
Field Detail
-
parent_cinfo
protected ClassInfoIF parent_cinfo
-
parent_class
protected Class<?> parent_class
-
fields
protected FieldInfoIF[] fields
-
fields_length
protected int fields_length
-
value_columns
protected String[] value_columns
-
column_count
protected int column_count
-
getter
protected Method getter
-
setter
protected Method setter
-
sqlType
protected int sqlType
-
-
Constructor Detail
-
IdentityFieldInfo
public IdentityFieldInfo(ClassInfoIF parent_cinfo, FieldInfoIF[] identity_fields)
-
-
Method Detail
-
getFields
public FieldInfoIF[] getFields()
INTERNAL: Returns the underlying FieldInfoIFs that the identity field spans.
-
getName
public String getName()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the field name.- Specified by:
getName
in interfaceFieldInfoIF
-
getIndex
public int getIndex()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the value field index of this field. This is the id (index) used by transactions and persistent instances to refer to this particular object field.- Specified by:
getIndex
in interfaceFieldInfoIF
-
getCardinality
public int getCardinality()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the field cardinality.- Specified by:
getCardinality
in interfaceFieldInfoIF
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:FieldInfoIF
INTERNAL: Returns true if this field is read-only field.- Specified by:
isReadOnly
in interfaceFieldInfoIF
-
isIdentityField
public boolean isIdentityField()
Description copied from interface:FieldHandlerIF
INTERNAL: Returns true if the field handler references an object identity field.- Specified by:
isIdentityField
in interfaceFieldHandlerIF
-
isCollectionField
public boolean isCollectionField()
Description copied from interface:FieldInfoIF
INTERNAL: Returns true if the field is a collection field (has a cardinality of 1:1 or 1:M).- Specified by:
isCollectionField
in interfaceFieldInfoIF
-
isPrimitiveField
public boolean isPrimitiveField()
Description copied from interface:FieldInfoIF
INTERNAL: Returns true if the field is a primitive field. Field value must be of primitive type.- Specified by:
isPrimitiveField
in interfaceFieldInfoIF
-
isReferenceField
public boolean isReferenceField()
Description copied from interface:FieldInfoIF
INTERNAL: Returns true if the field is a reference field. Field value must be of identifiable type.- Specified by:
isReferenceField
in interfaceFieldInfoIF
-
isAggregateField
public boolean isAggregateField()
Description copied from interface:FieldInfoIF
INTERNAL: Returns true if the field is an aggregate field. Field value must be of aggregate type.- Specified by:
isAggregateField
in interfaceFieldInfoIF
-
getParentClassInfo
public ClassInfoIF getParentClassInfo()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the class info for the field's object type.- Specified by:
getParentClassInfo
in interfaceFieldInfoIF
-
getValueClassInfo
public ClassInfoIF getValueClassInfo()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the class info for the field's value type. Note that primitive value classes don't have a class info.- Specified by:
getValueClassInfo
in interfaceFieldInfoIF
-
getValueClass
public Class<?> getValueClass()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the field value class. For primitive fields the primitive wrapper class is returned.- Specified by:
getValueClass
in interfaceFieldInfoIF
-
getTable
public String getTable()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the table in which the field value is stored (aka the master table).- Specified by:
getTable
in interfaceFieldInfoIF
-
getColumnCount
public int getColumnCount()
Description copied from interface:FieldHandlerIF
INTERNAL: Returns the number of columns that the field spans.- Specified by:
getColumnCount
in interfaceFieldHandlerIF
-
getValueColumns
public String[] getValueColumns()
Description copied from interface:FieldInfoIF
INTERNAL: Returns the names of the columns that the field spans.- Specified by:
getValueColumns
in interfaceFieldInfoIF
-
computeValueColumns
protected String[] computeValueColumns()
-
getValue
public Object getValue(Object object) throws Exception
Description copied from interface:FieldInfoIF
INTERNAL: Gets the field value from the given object.- Specified by:
getValue
in interfaceFieldInfoIF
- Throws:
Exception
-
setValue
public void setValue(Object object, Object value) throws Exception
Description copied from interface:FieldInfoIF
INTERNAL: Sets the field value for the given object.- Specified by:
setValue
in interfaceFieldInfoIF
- Throws:
Exception
-
getJoinTable
public String getJoinTable()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the name of the table which needs to be joined to order to access the field value from the master table.- Specified by:
getJoinTable
in interfaceFieldInfoIF
-
getJoinKeys
public String[] getJoinKeys()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the columns in the join table that contains the keys of the referencing object.- Specified by:
getJoinKeys
in interfaceFieldInfoIF
-
getManyKeys
public String[] getManyKeys()
Description copied from interface:FieldInfoIF
INTERNAL: Gets the columns in the join table that contains the keys of the referenced object.- Specified by:
getManyKeys
in interfaceFieldInfoIF
-
load
public Object load(AccessRegistrarIF registrar, TicketIF ticket, ResultSet rs, int rsindex, boolean direct) throws SQLException
INTERNAL: Loads from its containing fields an IdentityIF with the field values as key.- Specified by:
load
in interfaceFieldHandlerIF
- Throws:
SQLException
-
bind
public void bind(Object value, PreparedStatement stm, int stmt_index) throws SQLException
INTERNAL: Binds the identity keys to the containing fields.- Specified by:
bind
in interfaceFieldHandlerIF
- Throws:
SQLException
-
retrieveFieldValues
public void retrieveFieldValues(Object value, List<Object> field_values)
- Specified by:
retrieveFieldValues
in interfaceFieldHandlerIF
-
retrieveSQLValues
public void retrieveSQLValues(Object value, List<SQLValueIF> sql_values)
- Specified by:
retrieveSQLValues
in interfaceFieldHandlerIF
-
getFieldInfos
public FieldInfoIF[] getFieldInfos()
INTERNAL: Returns the underlying FieldInfoIF instances.
-
-