org.apache.ojb.broker.metadata
Class FieldDescriptor

java.lang.Object
  extended by org.apache.ojb.broker.metadata.AttributeDescriptorBase
      extended by org.apache.ojb.broker.metadata.FieldDescriptor
All Implemented Interfaces:
java.io.Serializable, AttributeContainer, RepositoryElements, XmlCapable
Direct Known Subclasses:
AnonymousFieldDescriptor

public class FieldDescriptor
extends AttributeDescriptorBase
implements XmlCapable, java.io.Serializable

A FieldDescriptor holds the mapping information for a specific member-variable of a persistent object.
Note: Be careful when use references of this class or caching instances of this class, because instances could become invalid (see MetadataManager).

Version:
$Id: FieldDescriptor.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Thomas Mahler
See Also:
Serialized Form

Field Summary
static java.lang.String ACCESS_ANONYMOUS
           
static java.lang.String ACCESS_READONLY
           
static java.lang.String ACCESS_READWRITE
           
 
Fields inherited from interface org.apache.ojb.broker.metadata.RepositoryElements
_NEXT, ACCEPT_LOCKS, ACCESS, ATTRIBUTE, ATTRIBUTE_NAME, ATTRIBUTE_VALUE, AUTO_DELETE, AUTO_INCREMENT, AUTO_RETRIEVE, AUTO_UPDATE, BATCH_MODE, CASCADE_LINK_STR, CASCADE_NONE_STR, CASCADE_OBJECT_STR, CLASS_DESCRIPTOR, CLASS_EXTENT, CLASS_NAME, CLASS_PROXY, CLASS_REF, COLLECTION_CLASS, COLLECTION_DESCRIPTOR, COLUMN_NAME, CON_LOG_ABANDONED, CON_MAX_ACTIVE, CON_MAX_IDLE, CON_MAX_WAIT, CON_MIN_EVICTABLE_IDLE_TIME_MILLIS, CON_NUM_TESTS_PER_EVICTION_RUN, CON_REMOVE_ABANDONED, CON_REMOVE_ABANDONED_TIMEOUT, CON_TEST_ON_BORROW, CON_TEST_ON_RETURN, CON_TEST_WHILE_IDLE, CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS, CON_WHEN_EXHAUSTED_ACTION, CONNECTION_FACTORY, CONNECTION_POOL, CONSTANT_ARGUMENT, DATASOURCE_NAME, DBMS_NAME, DEFAULT_CONNECTION, DELETE_PROCEDURE, DOCUMENTATION, DRIVER_NAME, EAGER_RELEASE, EXTENDS, FACTORY_CLASS, FACTORY_METHOD, FIELD_CONVERSION, FIELD_DESCRIPTOR, FIELD_ID_REF, FIELD_NAME, FIELD_REF, FK_POINTING_TO_ITEMS_CLASS, FK_POINTING_TO_THIS_CLASS, FOREIGN_KEY, ID, IGNORE_AUTOCOMMIT_EXCEPTION, INCLUDE_ALL_FIELDS, INCLUDE_PK_FIELDS_ONLY, INDEX_COLUMN, INDEX_DESCRIPTOR, INDEXED, INDIRECTION_TABLE, INITIALIZATION_METHOD, INSERT_PROCEDURE, INVERSE_FK, ISOLATION_LEVEL, ITEMS_CLASS, JCD_ALIAS, JDBC_CONNECTION_DESCRIPTOR, JDBC_LEVEL, JDBC_TYPE, LENGTH, LOCKING, MAPPING_REPOSITORY, NAME, NULLABLE, OBJECT_CACHE, ORDERBY, OTM_DEPENDENT, PRECISION, PRIMARY_KEY, PROXY_PREFETCHING_LIMIT, PROXY_REFERENCE, QUERY_CUSTOMIZER, REFERENCE_DESCRIPTOR, REFERENCED_CLASS, REFRESH, REPOSITORY_VERSION, RETURN, RETURN_FIELD_REF, ROW_READER, RUNTIME_ARGUMENT, SCALE, SCHEMA_NAME, SEQUENCE_MANAGER, SEQUENCE_MANAGER_CLASS, SEQUENCE_NAME, SORT, TABLE_NAME, TAG_ACCESS, TAG_ACCESS_ANONYMOUS, TAG_ACCESS_READONLY, TAG_ACCESS_READWRITE, TAG_SUPER, UNIQUE, UPDATE_LOCK, UPDATE_PROCEDURE, URL_DBALIAS, URL_PROTOCOL, URL_SUBPROTOCOL, USE_AUTOCOMMIT, USER_NAME, USER_PASSWD, VALIDATION_QUERY, VALUE
 
Constructor Summary
FieldDescriptor(ClassDescriptor cld, int id)
          Constructor declaration
 
Method Summary
 void addAttribute(java.lang.String attributeName, java.lang.String attributeValue)
          Store the specified attribute and it's value.
 java.lang.Object clone()
           
 java.lang.String getAccess()
           
 java.lang.String getAttribute(java.lang.String attributeName)
          Get the value of an attribute
 java.lang.String getAttribute(java.lang.String attributeName, java.lang.String defaultValue)
          Get the value of an attribute
 java.lang.String[] getAttributeNames()
          Returns an array of the names of all atributes of this descriptor.
 java.util.Map getAttributes()
          Returns the attribute map (name, value) of this descriptor.
 int getColNo()
           
 java.lang.String getColumnName()
           
 java.lang.String getColumnType()
           
static java.util.Comparator getComparator()
          returns a comparator that allows to sort a Vector of FieldMappingDecriptors according to their m_Order entries.
 FieldConversion getFieldConversion()
          Gets the fieldConversion.
 java.lang.String getFullColumnName()
          Answer the qualified ColumnName
ie: myTab.name
 JdbcType getJdbcType()
          Returns the corresponding database JdbcType) of this field, defined by the JDBC 3.0 specification, e.g.
 int getLength()
           
 int getPrecision()
           
 int getScale()
           
 java.lang.String getSequenceName()
           
 boolean isAccessReadOnly()
           
 boolean isAnonymous()
          Returns true if this field is declared as anonymous field.
 boolean isAutoIncrement()
           
 boolean isIndexed()
           
 boolean isLengthSpecified()
           
 boolean isLocking()
          Gets the locking.
 boolean isPrecisionSpecified()
           
 boolean isPrimaryKey()
           
 boolean isRequired()
           
 boolean isScaleSpecified()
           
 boolean isUpdateLock()
          Gets the updateLock updateLock controls whether the lock fields should be updated by OJB when a row is saved If false then the dbms needs to update the lock fields.
 void setAccess(java.lang.String access)
           
 void setAutoIncrement(boolean autoIncrement)
           
 void setColumnName(java.lang.String str)
           
 void setColumnType(java.lang.String str)
           
 void setFieldConversion(FieldConversion fieldConversion)
          Deprecated. use setFieldConversionClassName instead
 void setFieldConversionClassName(java.lang.String fieldConversionClassName)
          Sets the fieldConversion.
 void setIndexed(boolean indexed)
           
 void setLength(int length)
           
 void setLengthSpecified(boolean lengthSpecified)
           
 void setLocking(boolean locking)
          Sets the locking.
 void setPrecision(int precision)
           
 void setPrecisionSpecified(boolean precisionSpecified)
           
 void setPrimaryKey(boolean b)
           
 void setRequired(boolean required)
           
 void setScale(int scale)
           
 void setScaleSpecified(boolean scaleSpecified)
           
 void setSequenceName(java.lang.String sequenceName)
           
 void setUpdateLock(boolean updateLock)
          Sets the updateLock updateLock controls whether the lock fields should be updated by OJB when a row is saved.
 java.lang.String toString()
          Returns a string representation of this class.
 java.lang.String toXML()
          returns the XML marshalled version of this instance.
 
Methods inherited from class org.apache.ojb.broker.metadata.AttributeDescriptorBase
getAttributeName, getClassDescriptor, getPersistentField, setClassDescriptor, setPersistentField, setPersistentField
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACCESS_ANONYMOUS

public static final java.lang.String ACCESS_ANONYMOUS
See Also:
Constant Field Values

ACCESS_READONLY

public static final java.lang.String ACCESS_READONLY
See Also:
Constant Field Values

ACCESS_READWRITE

public static final java.lang.String ACCESS_READWRITE
See Also:
Constant Field Values
Constructor Detail

FieldDescriptor

public FieldDescriptor(ClassDescriptor cld,
                       int id)
Constructor declaration

Parameters:
cld - The parent ClassDescriptor
id - A field id - unique against all other fields in the ClassDescriptor
Method Detail

getComparator

public static java.util.Comparator getComparator()
returns a comparator that allows to sort a Vector of FieldMappingDecriptors according to their m_Order entries.


getColumnName

public java.lang.String getColumnName()

getFullColumnName

public java.lang.String getFullColumnName()
Answer the qualified ColumnName
ie: myTab.name

Returns:

setColumnName

public void setColumnName(java.lang.String str)

getColumnType

public java.lang.String getColumnType()

setColumnType

public void setColumnType(java.lang.String str)

getJdbcType

public JdbcType getJdbcType()
Returns the corresponding database JdbcType) of this field, defined by the JDBC 3.0 specification, e.g. VARCHAR, VARBINARY ...

The complement class is FieldType) which manage the java field type, e.g. a String, byte[] ... Returns the mapped jdbc type of this field (see complement FieldType), defined by the JDBC specification.

Returns:
The jdbc database type of this field.

toString

public java.lang.String toString()
Returns a string representation of this class.

Overrides:
toString in class AttributeDescriptorBase

getFieldConversion

public FieldConversion getFieldConversion()
Gets the fieldConversion.

Returns:
Returns a FieldConversion

setFieldConversion

public void setFieldConversion(FieldConversion fieldConversion)
Deprecated. use setFieldConversionClassName instead

Sets the fieldConversion.

Parameters:
fieldConversion - The fieldConversion to set

setFieldConversionClassName

public void setFieldConversionClassName(java.lang.String fieldConversionClassName)
Sets the fieldConversion.

Parameters:
fieldConversionClassName - The fieldConversion to set

isIndexed

public boolean isIndexed()

setIndexed

public void setIndexed(boolean indexed)

isAutoIncrement

public boolean isAutoIncrement()

setAutoIncrement

public void setAutoIncrement(boolean autoIncrement)

getSequenceName

public java.lang.String getSequenceName()

setSequenceName

public void setSequenceName(java.lang.String sequenceName)

isPrimaryKey

public boolean isPrimaryKey()

setPrimaryKey

public void setPrimaryKey(boolean b)

getColNo

public int getColNo()

isLocking

public boolean isLocking()
Gets the locking.

Returns:
Returns a boolean

setLocking

public void setLocking(boolean locking)
Sets the locking.

Parameters:
locking - The locking to set

isUpdateLock

public boolean isUpdateLock()
Gets the updateLock updateLock controls whether the lock fields should be updated by OJB when a row is saved If false then the dbms needs to update the lock fields. The default is true

Returns:
Returns a boolean

setUpdateLock

public void setUpdateLock(boolean updateLock)
Sets the updateLock updateLock controls whether the lock fields should be updated by OJB when a row is saved. If false then the dbms needs to update the lock fields. The default is true

Parameters:
updateLock - The updateLock to set

setLength

public void setLength(int length)

getLength

public int getLength()

setPrecision

public void setPrecision(int precision)

getPrecision

public int getPrecision()

setScale

public void setScale(int scale)

getScale

public int getScale()

isRequired

public boolean isRequired()

setRequired

public void setRequired(boolean required)

isScaleSpecified

public boolean isScaleSpecified()

setScaleSpecified

public void setScaleSpecified(boolean scaleSpecified)

isPrecisionSpecified

public boolean isPrecisionSpecified()

setPrecisionSpecified

public void setPrecisionSpecified(boolean precisionSpecified)

isLengthSpecified

public boolean isLengthSpecified()

setLengthSpecified

public void setLengthSpecified(boolean lengthSpecified)

getAccess

public java.lang.String getAccess()

setAccess

public void setAccess(java.lang.String access)

isAccessReadOnly

public boolean isAccessReadOnly()

isAnonymous

public boolean isAnonymous()
Returns true if this field is declared as anonymous field.


toXML

public java.lang.String toXML()
Description copied from interface: XmlCapable
returns the XML marshalled version of this instance.

Specified by:
toXML in interface XmlCapable
Returns:
the XML String representing this object.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

addAttribute

public void addAttribute(java.lang.String attributeName,
                         java.lang.String attributeValue)
Description copied from interface: AttributeContainer
Store the specified attribute and it's value.

Specified by:
addAttribute in interface AttributeContainer
Parameters:
attributeName - the name of the attribute to retrieve
attributeValue - the attribute's value
See Also:
AttributeContainer.addAttribute(String, String)

getAttribute

public java.lang.String getAttribute(java.lang.String attributeName,
                                     java.lang.String defaultValue)
Description copied from interface: AttributeContainer
Get the value of an attribute

Specified by:
getAttribute in interface AttributeContainer
Parameters:
attributeName - the attribute to retrieve
defaultValue - the value to return if the attribute is not present
Returns:
the attribute value
See Also:
AttributeContainer.getAttribute(String, String)

getAttribute

public java.lang.String getAttribute(java.lang.String attributeName)
Description copied from interface: AttributeContainer
Get the value of an attribute

Specified by:
getAttribute in interface AttributeContainer
Parameters:
attributeName - the attribute to retrieve
Returns:
the attribute value
See Also:
AttributeContainer.getAttribute(String)

getAttributes

public java.util.Map getAttributes()
Returns the attribute map (name, value) of this descriptor. Note that the returned map is not modifiable.

Returns:
The attributes

getAttributeNames

public java.lang.String[] getAttributeNames()
Returns an array of the names of all atributes of this descriptor.

Returns:
The list of attribute names (will not be null)


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30