ch.sahits.model.db
Class DataBaseTableField

java.lang.Object
  extended by ch.sahits.model.db.DataBaseTableField

public class DataBaseTableField
extends java.lang.Object

This class describes a database field.

Since:
0.9.0
Author:
Andi Hotz

Constructor Summary
DataBaseTableField()
          Default constructor
DataBaseTableField(java.lang.String _fieldName, java.lang.Class _fieldType, boolean _nullAllowed)
          Deprecated. This cunstructor is depricated in favor of DataBaseTableField(String, Class, boolean, boolean) The autogenerateKey flag is set to default
DataBaseTableField(java.lang.String _fieldName, java.lang.Class _fieldType, boolean _nullAllowed, boolean autogeneratedKey)
          Constructor initializes all fields
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare the name and type of the field
 java.lang.String getFieldName()
          Retrieve the field name
 java.lang.Class getFieldType()
          Retrieve the type of the field
 int hashCode()
           
 boolean isAlphaNumeric()
          Check if the field type is a primitve type or its wrapper class
 boolean isAutoGenKey()
           
 boolean isNullAllowed()
          Check if null values are allowed
 void setAutoGenKey(boolean isAutoGenKey)
           
 void setFieldName(java.lang.String _fieldName)
          Set the name of the field.
 void setFieldType(java.lang.Class _fieldType)
          Set the Java type of the field
 void setNullAllowed(boolean _nullAllowed)
          Set the null value allowed flag
 java.lang.String toString()
          Convert this to a string representation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataBaseTableField

@Deprecated
public DataBaseTableField(java.lang.String _fieldName,
                                     java.lang.Class _fieldType,
                                     boolean _nullAllowed)
Deprecated. This cunstructor is depricated in favor of DataBaseTableField(String, Class, boolean, boolean) The autogenerateKey flag is set to default

Constructor initializes all fields

Parameters:
_fieldName - name of the field
_fieldType - Java type of the field
_nullAllowed - are null values allowed

DataBaseTableField

public DataBaseTableField(java.lang.String _fieldName,
                          java.lang.Class _fieldType,
                          boolean _nullAllowed,
                          boolean autogeneratedKey)
Constructor initializes all fields

Parameters:
_fieldName - name of the field
_fieldType - Java type of the field
_nullAllowed - are null values allowed
autogeneratedKey - is the field an autogenerated key

DataBaseTableField

public DataBaseTableField()
Default constructor

Method Detail

getFieldName

public java.lang.String getFieldName()
Retrieve the field name

Returns:
Name of the field

setFieldName

public void setFieldName(java.lang.String _fieldName)
Set the name of the field. The name is always stored in upper-case

Parameters:
_fieldName - Name of the field

getFieldType

public java.lang.Class getFieldType()
Retrieve the type of the field

Returns:
corresponding Java type of the field

setFieldType

public void setFieldType(java.lang.Class _fieldType)
Set the Java type of the field

Parameters:
_fieldType - corresponding Java type of the field

isNullAllowed

public boolean isNullAllowed()
Check if null values are allowed

Returns:
true if null is allowed

setNullAllowed

public void setNullAllowed(boolean _nullAllowed)
Set the null value allowed flag

Parameters:
_nullAllowed -

toString

public java.lang.String toString()
Convert this to a string representation

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode(), equals(Object)

equals

public boolean equals(java.lang.Object obj)
Compare the name and type of the field

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

isAlphaNumeric

public boolean isAlphaNumeric()
Check if the field type is a primitve type or its wrapper class

Returns:
fales if the type is a primitive type or its wrapper class else true
See Also:
Class.isPrimitive()

setAutoGenKey

public void setAutoGenKey(boolean isAutoGenKey)
Parameters:
isAutoGenKey - the isAutoGenKey to set

isAutoGenKey

public boolean isAutoGenKey()
Returns:
the isAutoGenKey