Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.map
Class DbAttribute  view DbAttribute download DbAttribute.java

java.lang.Object
  extended byorg.objectstyle.cayenne.map.MapObject
      extended byorg.objectstyle.cayenne.map.Attribute
          extended byorg.objectstyle.cayenne.map.DbAttribute
All Implemented Interfaces:
org.objectstyle.cayenne.util.CayenneMapEntry
Direct Known Subclasses:
DerivedDbAttribute

public class DbAttribute
extends Attribute

A DbAttribute defines a descriptor for a single database table column.


Field Summary
protected  boolean mandatory
          If true, column corresponding to this attribute does not allows nulls.
protected  int maxLength
           
protected  int precision
           
protected  boolean primaryKey
          If true, this attribute is a part of primary key.
protected  int type
          The type of the column.
 
Fields inherited from class org.objectstyle.cayenne.map.MapObject
objName, objParent
 
Constructor Summary
DbAttribute()
           
DbAttribute(java.lang.String name)
           
DbAttribute(java.lang.String name, int type, DbEntity entity)
           
 
Method Summary
 java.lang.String getAliasedName(java.lang.String alias)
           
 int getMaxLength()
          Returns the length of database column described by this attribute.
 int getPrecision()
          Returns the number of digits after period for DECIMAL.
 int getType()
          Returns the SQL type of the column.
 boolean isMandatory()
           
 boolean isPrimaryKey()
           
 void setMandatory(boolean mandatory)
           
 void setMaxLength(int maxLength)
          Sets the length of character or binary type or max num of digits for DECIMAL.
 void setPrecision(int precision)
          Sets the number of digits after period for DECIMAL.
 void setPrimaryKey(boolean primaryKey)
           
 void setType(int type)
          Sets the SQL type for the column.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 java.lang.StringBuffer toStringBuffer(java.lang.StringBuffer buf)
          Appends string representation of attribute to a provided buffer.
 
Methods inherited from class org.objectstyle.cayenne.map.Attribute
getEntity, setEntity
 
Methods inherited from class org.objectstyle.cayenne.map.MapObject
getName, getParent, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected int type
The type of the column.


mandatory

protected boolean mandatory
If true, column corresponding to this attribute does not allows nulls.


primaryKey

protected boolean primaryKey
If true, this attribute is a part of primary key.


maxLength

protected int maxLength

precision

protected int precision
Constructor Detail

DbAttribute

public DbAttribute()

DbAttribute

public DbAttribute(java.lang.String name)

DbAttribute

public DbAttribute(java.lang.String name,
                   int type,
                   DbEntity entity)
Method Detail

getAliasedName

public java.lang.String getAliasedName(java.lang.String alias)

getType

public int getType()
Returns the SQL type of the column.


setType

public void setType(int type)
Sets the SQL type for the column.


isPrimaryKey

public boolean isPrimaryKey()

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)

isMandatory

public boolean isMandatory()

setMandatory

public void setMandatory(boolean mandatory)

getMaxLength

public int getMaxLength()
Returns the length of database column described by this attribute.


setMaxLength

public void setMaxLength(int maxLength)
Sets the length of character or binary type or max num of digits for DECIMAL.


getPrecision

public int getPrecision()
Returns the number of digits after period for DECIMAL.


setPrecision

public void setPrecision(int precision)
Sets the number of digits after period for DECIMAL.


toStringBuffer

public java.lang.StringBuffer toStringBuffer(java.lang.StringBuffer buf)
Appends string representation of attribute to a provided buffer. This is a variation of "toString" method. It may be more efficient in some cases. For example, when printing all attributes of a single entity together.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).