com.objectwave.persist
Class AttributeTypeColumn

java.lang.Object
  |
  +--com.objectwave.persist.AttributeTypeColumn
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
MapInformation

public class AttributeTypeColumn
extends java.lang.Object
implements java.lang.Comparable

A class that is used to describe an object's attribute. An instance of this class will exist for every attribute defined in the system.

Version:
$Id: AttributeTypeColumn.java,v 2.3 2002/08/23 18:05:15 dave_hoag Exp $
Author:
David Hoag

Field Summary
static Type ATTRIBUTE
           
static Type COLLECTION
           
static Type FOREIGN
           
static Type INSTANCE
           
protected  JoinField[] joinFields
           
static Type PLACEHOLDER
           
static Type PRIMARYATT
           
static Type TYPEATT
           
 
Constructor Summary
AttributeTypeColumn()
          Subclasses such as wrapper classes may need this.
AttributeTypeColumn(java.lang.Class pObj, java.lang.reflect.Field fd, Type t)
          Used to create instance links that can not be proxied.
AttributeTypeColumn(java.lang.Class pObj, java.lang.String name, java.lang.reflect.Field fd, Type t)
           
AttributeTypeColumn(Persistence pObj, java.lang.String name, java.lang.reflect.Field fd, Type t)
           
AttributeTypeColumn(java.lang.String name, java.lang.reflect.Field fd, Type t)
          Most often used for ATTRIBUTE types.
 
Method Summary
 void addJoinField(JoinField joinField)
          Adds a feature to the JoinField attribute of the AttributeTypeColumn object
 int compareTo(java.lang.Object o)
          compares
 boolean equals(AttributeTypeColumn aValue)
           
static AttributeTypeColumn getAttributeRelation(java.lang.String columnName, java.lang.reflect.Field fd)
          Convenience method for creating Attribute relations.
 CollectionAdapter getCollectionAdapter()
           
static AttributeTypeColumn getCollectionRelation(java.lang.Class c, java.lang.reflect.Field fd)
          Convenience method for creating Collection relations.
 java.lang.String getColumnName()
          Gets the ColumnName attribute of the AttributeTypeColumn object
 ConstraintCompare getConstraint()
          Gets the Constraint attribute of the AttributeTypeColumn object
 java.lang.reflect.Field getField()
          Gets the Field attribute of the AttributeTypeColumn object
static AttributeTypeColumn getForeignRelation(java.lang.Class c, java.lang.String columnName, java.lang.reflect.Field fd)
          Convenience method for creating Foreign relations.
static AttributeTypeColumn getInstanceRelation(java.lang.Class c, java.lang.reflect.Field fd)
          Convenience method for creating Instance relations.
static AttributeTypeColumn getInstanceRelation(java.lang.Class c, java.lang.String columnName, java.lang.reflect.Field fd)
          Convenience method for creating Instance relations.
 JoinField[] getJoinFields()
          Gets the JoinFields attribute of the AttributeTypeColumn object
 java.lang.reflect.Field getJoinOn()
          By default, foreign key links join on the other object PrimaryKeyField.
 Persistence getPersistentType()
          A persistentType is the class of the persistent object we wish to build.
 java.lang.Class getRelatedType()
          A relatedType is the class of the persistent object we wish to build.
 Type getType()
          Collection, Foreign, Instance, Attribute, PrimaryAttribute
static AttributeTypeColumn getTypeAttributeRelation(java.lang.String columnName, java.lang.reflect.Field fd)
           
 java.lang.Object getValue(Persistence obj)
          Convenience method to allow one to retrieve a single attribute from a persistent object.
 java.lang.Object getValue(Persistence obj, java.lang.reflect.Field[] fields, java.lang.Object[] values)
          Convenience method to allow one to retrieve a single attribute from a persistent object.
 void setAsPrimary()
          An easy way change the type to be a primary attribute.
 void setCollectionAdpater(CollectionAdapter adapter)
          This attribute is only used for the CollectionType.
 void setColumnName(java.lang.String nm)
          Sets the ColumnName attribute of the AttributeTypeColumn object
 void setConstraint(ConstraintCompare comp)
          Sets the Constraint attribute of the AttributeTypeColumn object
 void setField(java.lang.reflect.Field fd)
          All AttributeTypeColumns are required to have a corresponding Field object.
 void setJoinOn(java.lang.reflect.Field theOtherField)
          By default, foreign key links join on the other object PrimaryKeyField.
 void setRelatedType(java.lang.Class c)
          This is type object we are going to use to attempt to match a field on one object to a field on another object.
 void setType(Type c)
           
 void setValue(Persistence obj, java.lang.Object aValue)
          Convenience method to allow one to update a single attribute on a persistent object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

public static final Type INSTANCE

FOREIGN

public static final Type FOREIGN

COLLECTION

public static final Type COLLECTION

ATTRIBUTE

public static final Type ATTRIBUTE

PRIMARYATT

public static final Type PRIMARYATT

TYPEATT

public static final Type TYPEATT

PLACEHOLDER

public static final Type PLACEHOLDER

joinFields

protected JoinField[] joinFields
Constructor Detail

AttributeTypeColumn

public AttributeTypeColumn()
Subclasses such as wrapper classes may need this.


AttributeTypeColumn

public AttributeTypeColumn(Persistence pObj,
                           java.lang.String name,
                           java.lang.reflect.Field fd,
                           Type t)
Parameters:
pObj -
name -
fd -
t -

AttributeTypeColumn

public AttributeTypeColumn(java.lang.Class pObj,
                           java.lang.reflect.Field fd,
                           Type t)
Used to create instance links that can not be proxied.

Parameters:
pObj -
fd -
t -

AttributeTypeColumn

public AttributeTypeColumn(java.lang.Class pObj,
                           java.lang.String name,
                           java.lang.reflect.Field fd,
                           Type t)
Parameters:
pObj -
name -
fd -
t -

AttributeTypeColumn

public AttributeTypeColumn(java.lang.String name,
                           java.lang.reflect.Field fd,
                           Type t)
Most often used for ATTRIBUTE types.

Parameters:
name -
fd -
t -
Method Detail

getAttributeRelation

public static AttributeTypeColumn getAttributeRelation(java.lang.String columnName,
                                                       java.lang.reflect.Field fd)
Convenience method for creating Attribute relations.

Parameters:
columnName -
fd -
Returns:
The AttributeRelation value

getCollectionRelation

public static AttributeTypeColumn getCollectionRelation(java.lang.Class c,
                                                        java.lang.reflect.Field fd)
Convenience method for creating Collection relations.

Parameters:
c -
fd -
Returns:
The CollectionRelation value

getForeignRelation

public static AttributeTypeColumn getForeignRelation(java.lang.Class c,
                                                     java.lang.String columnName,
                                                     java.lang.reflect.Field fd)
Convenience method for creating Foreign relations.

Parameters:
c -
columnName -
fd -
Returns:
The ForeignRelation value

getInstanceRelation

public static AttributeTypeColumn getInstanceRelation(java.lang.Class c,
                                                      java.lang.reflect.Field fd)
Convenience method for creating Instance relations.

Parameters:
c -
fd -
Returns:
The InstanceRelation value

getInstanceRelation

public static AttributeTypeColumn getInstanceRelation(java.lang.Class c,
                                                      java.lang.String columnName,
                                                      java.lang.reflect.Field fd)
Convenience method for creating Instance relations.

Parameters:
c -
columnName -
fd -
Returns:
The InstanceRelation value

getTypeAttributeRelation

public static AttributeTypeColumn getTypeAttributeRelation(java.lang.String columnName,
                                                           java.lang.reflect.Field fd)
Parameters:
columnName - java.lang.String
fd - java.lang.reflect.Field
Returns:
com.objectwave.persist.AttributeTypeColumn

setAsPrimary

public void setAsPrimary()
An easy way change the type to be a primary attribute.


setColumnName

public void setColumnName(java.lang.String nm)
Sets the ColumnName attribute of the AttributeTypeColumn object

Parameters:
nm - The new ColumnName value

setField

public void setField(java.lang.reflect.Field fd)
All AttributeTypeColumns are required to have a corresponding Field object.

Parameters:
fd - The new Field value

setRelatedType

public void setRelatedType(java.lang.Class c)
This is type object we are going to use to attempt to match a field on one object to a field on another object. By default, this type is also going to be instatiated via the default constructor when building proxies. This can be overridden, but that is the default behavior.

Parameters:
c - The new RelatedType value

setType

public void setType(Type c)
Parameters:
c - The new Type value

setValue

public void setValue(Persistence obj,
                     java.lang.Object aValue)
Convenience method to allow one to update a single attribute on a persistent object.

Parameters:
obj - The new Value value
aValue - The new Value value

setCollectionAdpater

public void setCollectionAdpater(CollectionAdapter adapter)
This attribute is only used for the CollectionType. With this it is possible to force the result set of the collection query to be a certain type.

Parameters:
adapter - com.objectwave.persist.CollectionAdapter An interface that allows building collections

setConstraint

public void setConstraint(ConstraintCompare comp)
Sets the Constraint attribute of the AttributeTypeColumn object

Parameters:
comp - The new Constraint value

setJoinOn

public void setJoinOn(java.lang.reflect.Field theOtherField)
By default, foreign key links join on the other object PrimaryKeyField. This is not always the case. If we don't want to join on the primary key field, but set the theOtherField to be the Field object from the other object. It would be more ideal to get the AttributeTypeColumn, but that can be hard to get.

Parameters:
theOtherField - The new JoinOn value

getJoinFields

public JoinField[] getJoinFields()
Gets the JoinFields attribute of the AttributeTypeColumn object

Returns:
The JoinFields value

getColumnName

public java.lang.String getColumnName()
Gets the ColumnName attribute of the AttributeTypeColumn object

Returns:
The ColumnName value

getField

public java.lang.reflect.Field getField()
Gets the Field attribute of the AttributeTypeColumn object

Returns:
The Field value

getPersistentType

public Persistence getPersistentType()
A persistentType is the class of the persistent object we wish to build. It is used when you have a reference (FOREIGN, COLLECTION, INSTANCE) to another object. The difference from relatedType come in the creation of new instances. New instances of the are created by asking the persistentObject for it's adapter and then asking the adapter for a new instance. This allows one to specifically customize a new instance, if customization of some sort is needed.

Returns:
The PersistentType value
See Also:
getRelatedType()

getRelatedType

public java.lang.Class getRelatedType()
A relatedType is the class of the persistent object we wish to build. It is used when you have a reference (FOREIGN, COLLECTION, INSTANCE) to another object. New instances of the related object are created via reflection.

Returns:
The RelatedType value
See Also:
getPersistentType()

getType

public Type getType()
Collection, Foreign, Instance, Attribute, PrimaryAttribute

Returns:
The Type value

getValue

public final java.lang.Object getValue(Persistence obj,
                                       java.lang.reflect.Field[] fields,
                                       java.lang.Object[] values)
Convenience method to allow one to retrieve a single attribute from a persistent object.

Parameters:
obj -
fields -
values -
Returns:
The Value value

getJoinOn

public java.lang.reflect.Field getJoinOn()
By default, foreign key links join on the other object PrimaryKeyField. This is not always the case. If we don't want to join on the primary key field, this will be set to the Field of the object object.

Returns:
The JoinOn value

getValue

public java.lang.Object getValue(Persistence obj)
Convenience method to allow one to retrieve a single attribute from a persistent object.

Parameters:
obj - The instance that holds the value represented by this attribute
Returns:
The object represented by this field in the Persistent parameter

getCollectionAdapter

public CollectionAdapter getCollectionAdapter()
Returns:
The CollectionAdapter value

getConstraint

public ConstraintCompare getConstraint()
Gets the Constraint attribute of the AttributeTypeColumn object

Returns:
The Constraint value

addJoinField

public void addJoinField(JoinField joinField)
Adds a feature to the JoinField attribute of the AttributeTypeColumn object

Parameters:
joinField - The feature to be added to the JoinField attribute

equals

public boolean equals(AttributeTypeColumn aValue)
Parameters:
aValue -
Returns:

compareTo

public int compareTo(java.lang.Object o)
compares

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns: