org.makumba
Interface FieldDefinition


public interface FieldDefinition

Information about a field from a makumba data definition as obtained from an MDD file. This class is provided for makumba programs to be able to introspect makumba data structures. Such introspection is not needed usually, as the application programmer knows the makumba data structure.


Field Summary
static int _binary
           
static int _boolean
           
static int _char
           
static int _charEnum
           
static int _date
           
static int _dateCreate
           
static int _dateModify
           
static int _file
           
static int _int
           
static int _intEnum
           
static int _nil
           
static int _ptr
           
static int _ptrIndex
           
static int _ptrOne
           
static int _ptrRel
           
static int _real
           
static int _set
           
static int _setCharEnum
           
static int _setComplex
           
static int _setIntEnum
           
static int _text
           
static String ERROR_NOT_EMPTY
           
static String ERROR_NOT_NULL
           
static String ERROR_NOT_UNIQUE
           
 
Method Summary
 void addValidationRule(Collection<ValidationRule> rules)
          adds several new validation rules to this field.
 void addValidationRule(ValidationRule rule)
          Adds a new validation rule to this field.
 void checkInsert(Dictionary<String,Object> d)
          check if the corresponding field from the dictionary can be inserted
 void checkUpdate(Dictionary<String,Object> d)
          check if the corresponding field from the dictionary can be updated
 Object checkValue(Object value)
          check if the value can be assigned
 DataDefinition getDataDefinition()
          The data definition that contains this field definition
 String getDataType()
          The data type of this field.
 Date getDefaultDate()
          Get the default value as a Date.
 int getDefaultInt()
          Get the default value as an integer.
 String getDefaultString()
          Get the default value as a String.
 Object getDefaultValue()
          returns the default value of this field
 Vector<String> getDeprecatedValues()
          returns the deprecated values for intEnum
 String getDescription()
          Returns field's description
 Object getEmptyValue()
          The value returned in case there is no value in the database and no default value is indicated
 int getEnumeratorSize()
          Get the number of the members of an enumerated field.
 DataDefinition getForeignTable()
          The type with which the ptr or set relation is defined.
 int getIntAt(int i)
          Get the integer at a certain position in an enumerated type.
 int getIntegerType()
          returns the integer value associated with the field's internal makumba type.
 Class<?> getJavaType()
          The Java type of this field.
 String getName()
          The name of this field, normally the same with the name of the field
 String getNameAt(int i)
          Get the name at a certain position in an enumerated field.
 String getNameFor(int i)
          Get the name for a certain value of the enumerated field.
 Collection<String> getNames()
          Get the names of an enumerated field.
 String getNotANumberErrorMessage()
          gets the error message for the not a number field constraint, if specified
 String getNotBooleanErrorMessage()
          gets the error message for the not a boolean field constraint, if specified
 String getNotEmptyErrorMessage()
          gets the error message for the not empty field constraint, if specified
 String getNotIntErrorMessage()
          gets the error message for the not an int field constraint, if specified
 String getNotNullErrorMessage()
          gets the error message for not null field, if specified
 String getNotRealErrorMessage()
          gets the error message for the not a real field constraint, if specified
 String getNotUniqueErrorMessage()
          gets the error message for the not unique field constraint, if specified
 Object getNull()
          The null value for this type
 FieldDefinition getOriginalFieldDefinition()
          The original field definition this field definition was made of, used e.g. in form responders.
 DataDefinition getPointedType()
          The type referred.
 DataDefinition getSubtable()
          The subtype created by an immediate ptr or set definition.
 String getTitleField()
          Get the alternative title field, if the title to be used is indicated specifically on a ptr or set.
 String getType()
          Returns field's internal makumba type.
 Collection<ValidationRule> getValidationRules()
          Returns all the validation rules connected to this field.
 Collection getValues()
          Get the values of an enumerated field.
 int getWidth()
          Get the maximum character width.
 boolean hasDescription()
          Tells wether this field has a description in the MDD
 boolean isAssignableFrom(FieldDefinition fd)
          check compatibility with the given type
 boolean isBinaryType()
          returns whether this field is a binary type.
 boolean isBooleanType()
          returns whether this field is a boolean type
 boolean isComplexSet()
          returns whether this field is a setComplex.
 boolean isDateType()
          returns whether this field is a date type, i.e. date, or the default fields dateCreate and dateModify.
 boolean isDefaultField()
          returns whether this field is a default field generated by makumba.
 boolean isEnumType()
          returns whether this field is a simple enum type, i.e. intEnum or charEnum.
 boolean isExternalSet()
          returns whether this field is an external set, i.e. set ptr, but not setIntEnum, not setCharEnum nor setComplex.
 boolean isFileType()
          returns whether this field is a file type.
 boolean isFixed()
          tells whether this field is fixed
 boolean isIndexPointerField()
          Indicates whether this field is the index pointer field of the DataDefinition it belongs to.
 boolean isIntegerType()
          returns whether this field is an integer type.
 boolean isInternalSet()
          returns whether this field is any kind of internal set type, i.e. set, setIntEnum, setCharEnum and setComplex, but not set.
 boolean isNotEmpty()
          tells whether this field is not empty
 boolean isNotNull()
          tells whether this field is not null
 boolean isNumberType()
          returns whether this field is a number type, i.e. int or real.
 boolean isPointer()
          returns whether this field is a pointer.
 boolean isRealType()
          returns whether this field is a real type.
 boolean isSetEnumType()
          returns whether this field is a set enum type, i.e. setIntEnum or setCharEnum.
 boolean isSetType()
          returns whether this field is a set type, i.e. set, setIntEnum or setCharEnum or setComplex.
 boolean isStringType()
          returns whether this field is a string type, i.e. char or text.
 boolean isUnique()
          tells whether this field is unique
 boolean shouldEditBySingleInput()
          Indicates whether this field should be edited by a simple mak:input, or needs it's own form.
 

Field Detail

_ptr

static final int _ptr
See Also:
Constant Field Values

_ptrRel

static final int _ptrRel
See Also:
Constant Field Values

_ptrOne

static final int _ptrOne
See Also:
Constant Field Values

_ptrIndex

static final int _ptrIndex
See Also:
Constant Field Values

_int

static final int _int
See Also:
Constant Field Values

_intEnum

static final int _intEnum
See Also:
Constant Field Values

_char

static final int _char
See Also:
Constant Field Values

_charEnum

static final int _charEnum
See Also:
Constant Field Values

_text

static final int _text
See Also:
Constant Field Values

_date

static final int _date
See Also:
Constant Field Values

_dateCreate

static final int _dateCreate
See Also:
Constant Field Values

_dateModify

static final int _dateModify
See Also:
Constant Field Values

_set

static final int _set
See Also:
Constant Field Values

_setComplex

static final int _setComplex
See Also:
Constant Field Values

_nil

static final int _nil
See Also:
Constant Field Values

_real

static final int _real
See Also:
Constant Field Values

_setCharEnum

static final int _setCharEnum
See Also:
Constant Field Values

_setIntEnum

static final int _setIntEnum
See Also:
Constant Field Values

_binary

static final int _binary
See Also:
Constant Field Values

_boolean

static final int _boolean
See Also:
Constant Field Values

_file

static final int _file
See Also:
Constant Field Values

ERROR_NOT_NULL

static final String ERROR_NOT_NULL
See Also:
Constant Field Values

ERROR_NOT_EMPTY

static final String ERROR_NOT_EMPTY
See Also:
Constant Field Values

ERROR_NOT_UNIQUE

static final String ERROR_NOT_UNIQUE
See Also:
Constant Field Values
Method Detail

getName

String getName()
The name of this field, normally the same with the name of the field


getDataDefinition

DataDefinition getDataDefinition()
The data definition that contains this field definition


getOriginalFieldDefinition

FieldDefinition getOriginalFieldDefinition()
The original field definition this field definition was made of, used e.g. in form responders.


isIndexPointerField

boolean isIndexPointerField()
Indicates whether this field is the index pointer field of the DataDefinition it belongs to.


getEmptyValue

Object getEmptyValue()
The value returned in case there is no value in the database and no default value is indicated


getNull

Object getNull()
The null value for this type


hasDescription

boolean hasDescription()
Tells wether this field has a description in the MDD


getDescription

String getDescription()
Returns field's description


getType

String getType()
Returns field's internal makumba type. Can be:


getIntegerType

int getIntegerType()
returns the integer value associated with the field's internal makumba type.


getDataType

String getDataType()
The data type of this field. For example, intEnum and int both have int as data type


getJavaType

Class<?> getJavaType()
The Java type of this field. For example, intEnum and int both have java.lang.Integer as data type


isFixed

boolean isFixed()
tells whether this field is fixed


isNotNull

boolean isNotNull()
tells whether this field is not null


isNotEmpty

boolean isNotEmpty()
tells whether this field is not empty


isUnique

boolean isUnique()
tells whether this field is unique


getDefaultValue

Object getDefaultValue()
returns the default value of this field


getDefaultString

String getDefaultString()
Get the default value as a String. Works only for char, text, charEnum, setcharEnum types

Throws:
ClassCastException - for other types

getDefaultInt

int getDefaultInt()
Get the default value as an integer. Works only for int, intEnum types

Throws:
ClassCastException - for other types

getDefaultDate

Date getDefaultDate()
Get the default value as a Date. Works only for date type

Throws:
ClassCastException - for other types

getValues

Collection getValues()
Get the values of an enumerated field. Works only for intEnum, charEnum types.

Throws:
ClassCastException - for other types

getNames

Collection<String> getNames()
Get the names of an enumerated field. Works only for intEnum, charEnum types

Throws:
ClassCastException - for other types

getEnumeratorSize

int getEnumeratorSize()
Get the number of the members of an enumerated field. Works only for intEnum, charEnum types

Throws:
ClassCastException - for other types

getNameAt

String getNameAt(int i)
Get the name at a certain position in an enumerated field. Works only for intEnum, charEnum types

Throws:
ClassCastException - for other types

getNameFor

String getNameFor(int i)
Get the name for a certain value of the enumerated field. Works only for intEnum or setIntEnum

Throws:
ClassCastException - for other types

getIntAt

int getIntAt(int i)
Get the integer at a certain position in an enumerated type. Works only for intEnum types

Throws:
ClassCastException - for other types

getWidth

int getWidth()
Get the maximum character width. Works only for char, charEnum, setcharEnum types

Throws:
ClassCastException - for other types

getForeignTable

DataDefinition getForeignTable()
The type with which the ptr or set relation is defined. Works only for ptr, ptrRel and set types

Returns:
the foreign type indicated in set or ptr definition
Throws:
ClassCastException - for other types

getSubtable

DataDefinition getSubtable()
The subtype created by an immediate ptr or set definition. Works only for ptrOne, set, setComplex types

Returns:
the subtype indicated in set or ptr definition
Throws:
ClassCastException - for other types

getPointedType

DataDefinition getPointedType()
The type referred. Will return getRelationType() for ptr, ptrRel and set types and getSubtype() for ptrOne, set, setComplex types. Works only for ptrOne, set, setComplex types

Returns:
the subtype indicated in set or ptr definition
Throws:
ClassCastException - for other types

getTitleField

String getTitleField()
Get the alternative title field, if the title to be used is indicated specifically on a ptr or set. Works only for ptr and set types

Returns:
title field of the record in the foreign table, as indicated in this field definition or in the respective foreign table record definition
Throws:
ClassCastException - for other types
See Also:
DataDefinition.getTitleFieldName()

isAssignableFrom

boolean isAssignableFrom(FieldDefinition fd)
check compatibility with the given type


checkValue

Object checkValue(Object value)
check if the value can be assigned


checkInsert

void checkInsert(Dictionary<String,Object> d)
check if the corresponding field from the dictionary can be inserted


checkUpdate

void checkUpdate(Dictionary<String,Object> d)
check if the corresponding field from the dictionary can be updated


getDeprecatedValues

Vector<String> getDeprecatedValues()
returns the deprecated values for intEnum


isDefaultField

boolean isDefaultField()
returns whether this field is a default field generated by makumba.


shouldEditBySingleInput

boolean shouldEditBySingleInput()
Indicates whether this field should be edited by a simple mak:input, or needs it's own form.


isDateType

boolean isDateType()
returns whether this field is a date type, i.e. date, or the default fields dateCreate and dateModify.


isNumberType

boolean isNumberType()
returns whether this field is a number type, i.e. int or real.


isIntegerType

boolean isIntegerType()
returns whether this field is an integer type.


isRealType

boolean isRealType()
returns whether this field is a real type.


isBinaryType

boolean isBinaryType()
returns whether this field is a binary type.


isBooleanType

boolean isBooleanType()
returns whether this field is a boolean type


isFileType

boolean isFileType()
returns whether this field is a file type.


isSetType

boolean isSetType()
returns whether this field is a set type, i.e. set, setIntEnum or setCharEnum or setComplex.


isSetEnumType

boolean isSetEnumType()
returns whether this field is a set enum type, i.e. setIntEnum or setCharEnum.


isEnumType

boolean isEnumType()
returns whether this field is a simple enum type, i.e. intEnum or charEnum.


isInternalSet

boolean isInternalSet()
returns whether this field is any kind of internal set type, i.e. set, setIntEnum, setCharEnum and setComplex, but not set.


isExternalSet

boolean isExternalSet()
returns whether this field is an external set, i.e. set ptr, but not setIntEnum, not setCharEnum nor setComplex.


isComplexSet

boolean isComplexSet()
returns whether this field is a setComplex.


isPointer

boolean isPointer()
returns whether this field is a pointer.


isStringType

boolean isStringType()
returns whether this field is a string type, i.e. char or text.


getValidationRules

Collection<ValidationRule> getValidationRules()
Returns all the validation rules connected to this field.


addValidationRule

void addValidationRule(ValidationRule rule)
Adds a new validation rule to this field.


addValidationRule

void addValidationRule(Collection<ValidationRule> rules)
adds several new validation rules to this field.


getNotNullErrorMessage

String getNotNullErrorMessage()
gets the error message for not null field, if specified


getNotANumberErrorMessage

String getNotANumberErrorMessage()
gets the error message for the not a number field constraint, if specified


getNotUniqueErrorMessage

String getNotUniqueErrorMessage()
gets the error message for the not unique field constraint, if specified


getNotEmptyErrorMessage

String getNotEmptyErrorMessage()
gets the error message for the not empty field constraint, if specified


getNotIntErrorMessage

String getNotIntErrorMessage()
gets the error message for the not an int field constraint, if specified


getNotRealErrorMessage

String getNotRealErrorMessage()
gets the error message for the not a real field constraint, if specified


getNotBooleanErrorMessage

String getNotBooleanErrorMessage()
gets the error message for the not a boolean field constraint, if specified