FileDocCategorySizeDatePackage
MetadataColumn.javaAPI DocGlassfish v2 API6425Tue May 22 16:54:26 BST 2007oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns

MetadataColumn

public class MetadataColumn extends Object
Object to hold onto column metadata in a TopLink database field.
author
Guy Pelletier
since
TopLink EJB 3.0 Reference Implementation

Fields Summary
protected String
m_attributeName
protected DatabaseField
m_databaseField
protected AnnotatedElement
m_annotatedElement
public static final int
DEFAULT_SCALE
public static final int
DEFAULT_LENGTH
public static final int
DEFAULT_PRECISION
public static final String
DEFAULT_NAME
public static final String
DEFAULT_TABLE
public static final String
DEFAULT_COLUMN_DEFINITION
public static final boolean
DEFAULT_UNIQUE
public static final boolean
DEFAULT_NULLABLE
public static final boolean
DEFAULT_UPDATABLE
public static final boolean
DEFAULT_INSERTABLE
Constructors Summary
public MetadataColumn(AttributeOverride attributeOverride, AnnotatedElement annotatedElement)
INTERNAL: Called for attribute overrides.

    
              
         
        this(attributeOverride.column(), attributeOverride.name(), annotatedElement);
    
public MetadataColumn(Column column, MetadataAccessor accessor)
INTERNAL: Called for basic mappings.

        this(column, accessor.getAttributeName(), accessor.getAnnotatedElement());
    
public MetadataColumn(Column column, String attributeName, AnnotatedElement annotatedElement)
INTERNAL:

        this(attributeName, annotatedElement);
        
        if (column != null) {
            // Apply the values from the column annotation.
            m_databaseField.setUnique(column.unique());
            m_databaseField.setNullable(column.nullable());
            m_databaseField.setUpdatable(column.updatable());
            m_databaseField.setInsertable(column.insertable());
        
            m_databaseField.setScale(column.scale());
            m_databaseField.setLength(column.length());
            m_databaseField.setPrecision(column.precision());
        
            m_databaseField.setName(column.name());
            m_databaseField.setTableName(column.table());
            m_databaseField.setColumnDefinition(column.columnDefinition());
        }
    
public MetadataColumn(String attributeName, AnnotatedElement annotatedElement)
INTERNAL: Initialize the database field with the default values.

        m_attributeName = attributeName;
        m_annotatedElement = annotatedElement;
        m_databaseField = new DatabaseField();
     
        // Apply default values.   
        m_databaseField.setUnique(DEFAULT_UNIQUE);
        m_databaseField.setNullable(DEFAULT_NULLABLE);
        m_databaseField.setUpdatable(DEFAULT_UPDATABLE);
        m_databaseField.setInsertable(DEFAULT_INSERTABLE);
        
        m_databaseField.setScale(DEFAULT_SCALE);
        m_databaseField.setLength(DEFAULT_LENGTH);
        m_databaseField.setPrecision(DEFAULT_PRECISION);
        
        m_databaseField.setName(DEFAULT_NAME);
        m_databaseField.setTableName(DEFAULT_TABLE);
        m_databaseField.setColumnDefinition(DEFAULT_COLUMN_DEFINITION);
    
Methods Summary
public java.lang.reflect.AnnotatedElementgetAnnotatedElement()
INTERNAL:

        return m_annotatedElement;
    
public java.lang.StringgetAttributeName()
INTERNAL:

        return m_attributeName;
    
public oracle.toplink.essentials.internal.helper.DatabaseFieldgetDatabaseField()
INTERNAL:

        return m_databaseField;
    
public java.lang.StringgetUpperCaseAttributeName()
INTERNAL:

        return m_attributeName.toUpperCase();
    
public booleanloadedFromXML()
INTERNAL:

        return false;
    
public voidsetDatabaseField(oracle.toplink.essentials.internal.helper.DatabaseField databaseField)
INTERNAL: This method will get called if we have an attribute override that overrides another attribute override. See EmbeddedAccessor.

        m_databaseField = databaseField;