org.gvsig.tools.dynobject
Interface DynField

All Known Implementing Classes:
DefaultDynField

public interface DynField

A field of a DynObject.

A field will be persisted only if it is set as persistent (@see isPersistent(), which is the default value.

Author:
Joaqu�n Jos� del Cerro

Field Summary
static int ANY
          Deprecated. now autodetect the mode of use
static int CHOICE
          Deprecated. usado automaticamente al asignar AvailableValues
static int RANGE
          Deprecated. usado automaticamente al asignar minValue/maxValue
 
Method Summary
 Object coerce(Object value)
          Force the type of value to the type of the field.
 DynObjectValueItem[] getAvailableValues()
          Return the available values for this field.
 Class getClassOfItems()
          If the field is a container (List, Map or Set) return the java class of its items.
 Class getClassOfValue()
          Return the java class of the value of the field.
 DataType getDataType()
           
 Object getDefaultValue()
          Return the default value used in creation of new objects with this field.
 String getDescription()
          Return the descripcion associated to this field.
 DynField getElementsType()
          When a field is of type container, this method return a DynClass that define the type of elements.
 String getGroup()
          Return a string that identify a group for this field.
 Object getMaxValue()
           
 Object getMinValue()
           
 String getName()
          Return the name of the field.
 int getOder()
          Return the ordinal that identify the order of this field in the DynObject.
 String getSubtype()
          Return the subtype associated to this field.
 int getTheTypeOfAvailableValues()
          Deprecated. don't use, check minValue/maxValue and getAvailableValues instead
 int getType()
          Return the type used in this field.
 boolean isContainer()
          Return true if the value of this field is a container.
 boolean isHidden()
          Inform if this field can be visible or not for the user.
 boolean isMandatory()
          Return true if this field is mandatory.
 boolean isPersistent()
          Returns if the field is persistent or volatile.
 boolean isReadOnly()
          Returns if the field is readOnly or not.
 DynField setAvailableValues(DynObjectValueItem[] values)
           
 DynField setAvailableValues(List values)
           
 DynField setClassOfItems(Class theClass)
          If field type is List, Set or Map, this class is the class of items.
 DynField setClassOfValue(Class theClass)
          Sets the class used for the values of the field.
 DynField setDefaultDynValue(Object defaultValue)
          Deprecated. use instead setDefaultFieldValue(Object)
 DynField setDefaultFieldValue(Object defaultValue)
          Set the default value used for this field when a new object with this field is created.
 DynField setDescription(String description)
          Sets the description asociated to this field.
 DynField setElementsType(DynStruct type)
          Set the type of items when the field is a container.
 DynField setElementsType(int type)
          Set the type of items when the field is a container.
 DynField setGroup(String groupName)
           
 DynField setHidden(boolean hidden)
           
 DynField setMandatory(boolean mandatory)
           
 DynField setMaxValue(Object maxValue)
           
 DynField setMinValue(Object minValue)
           
 DynField setOrder(int order)
           
 DynField setPersistent(boolean persistent)
          Sets if the field must be persisted or not.
 DynField setReadOnly(boolean isReadOnly)
          Sets if the field is readOnly or not.
 DynField setSubtype(String subtype)
          Strings used as subtype for this field.
 DynField setTheTypeOfAvailableValues(int type)
          Deprecated. don't use, set minValue/maxValue and availableValues instead
 DynField setType(DataType type)
           
 DynField setType(int type)
          Sets the type of the field.
 void validate(Object value)
          Validate that the value match the properties of the field.
 

Field Detail

ANY

static final int ANY
Deprecated. now autodetect the mode of use
If the field value can be any possible value, for its type.

See Also:
Constant Field Values

CHOICE

static final int CHOICE
Deprecated. usado automaticamente al asignar AvailableValues
If the field value must be one of a list of posible values.

See Also:
Constant Field Values

RANGE

static final int RANGE
Deprecated. usado automaticamente al asignar minValue/maxValue
If the field value must pertain to a range of possible values.

See Also:
Constant Field Values
Method Detail

getName

String getName()
Return the name of the field.

Returns:
name of the field

getType

int getType()
Return the type used in this field. The values of type is the same of DataTypes

Returns:

getDataType

DataType getDataType()

getSubtype

String getSubtype()
Return the subtype associated to this field. The subtype is a string used for the cliente of the field. When the field is of type #DataTypes.DYNOBJECT, the subtype are the fullname of the DynClass.

Returns:
the subtype of the field.

getDescription

String getDescription()
Return the descripcion associated to this field.

Returns:
the description of the field.

getDefaultValue

Object getDefaultValue()
Return the default value used in creation of new objects with this field.

Returns:
defaulr value to use for this field.

getGroup

String getGroup()
Return a string that identify a group for this field. The groups are defined by the client of the field.

Returns:
the group of the field

getOder

int getOder()
Return the ordinal that identify the order of this field in the DynObject.

Returns:
the order of field in the DynObject

isMandatory

boolean isMandatory()
Return true if this field is mandatory.


isPersistent

boolean isPersistent()
Returns if the field is persistent or volatile. The meaning of being persistent depends on how is persisted, but any persistence mechanism must avoid persisting this field value.

Returns:
if the field is to be persisted or not

isHidden

boolean isHidden()
Inform if this field can be visible or not for the user. This value don't affect the access through the API.

Returns:
true if the field is hidden for the user.

isReadOnly

boolean isReadOnly()
Returns if the field is readOnly or not. The meaning of being readOnly allows to know if the user input to any graphic component associated to this field should be allowed or not.

Returns:
if the graphic component associated to this field should be readOnly or not

isContainer

boolean isContainer()
Return true if the value of this field is a container. This method uses the same criteria of the DataType

Returns:
true if the field type is a container

getAvailableValues

DynObjectValueItem[] getAvailableValues()
Return the available values for this field. When assign a value to the field, this value need that exists in this list.

Returns:
an array of the available values for the field.

getMinValue

Object getMinValue()

getMaxValue

Object getMaxValue()

getClassOfValue

Class getClassOfValue()
Return the java class of the value of the field.

Returns:
the class of the value

getClassOfItems

Class getClassOfItems()
If the field is a container (List, Map or Set) return the java class of its items.

Returns:
the class of the items

setDescription

DynField setDescription(String description)
Sets the description asociated to this field.

Parameters:
description -
Returns:
this same DynField object

setType

DynField setType(int type)
Sets the type of the field. The values used are the specified in DataTypes. This method assign the default values of the type for "ClassOfValue" and "subType".

Parameters:
type -
Returns:
this same DynField object

setType

DynField setType(DataType type)

setSubtype

DynField setSubtype(String subtype)
Strings used as subtype for this field. This value is used by the client of the object. When the field is a #DataTypes.DYNOBJECT, the subtype is the fullname of the DynStruct.

Parameters:
subtype -
Returns:
this same DynField object

setDefaultFieldValue

DynField setDefaultFieldValue(Object defaultValue)
Set the default value used for this field when a new object with this field is created.

Parameters:
defaultValue -
Returns:
this same DynField object

setGroup

DynField setGroup(String groupName)

setOrder

DynField setOrder(int order)

setMandatory

DynField setMandatory(boolean mandatory)

setHidden

DynField setHidden(boolean hidden)

setPersistent

DynField setPersistent(boolean persistent)
Sets if the field must be persisted or not.

Parameters:
persistent - if the field must be persisted or not
Returns:
this same DynField object
See Also:
isPersistent()

setAvailableValues

DynField setAvailableValues(DynObjectValueItem[] values)

setAvailableValues

DynField setAvailableValues(List values)

setMinValue

DynField setMinValue(Object minValue)

setMaxValue

DynField setMaxValue(Object maxValue)

setClassOfValue

DynField setClassOfValue(Class theClass)
                         throws DynFieldIsNotAContainerException
Sets the class used for the values of the field.

Parameters:
theClass -
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException

setClassOfItems

DynField setClassOfItems(Class theClass)
                         throws DynFieldIsNotAContainerException
If field type is List, Set or Map, this class is the class of items.

Parameters:
theClass -
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException

setReadOnly

DynField setReadOnly(boolean isReadOnly)
Sets if the field is readOnly or not. The meaning of being readOnly allows to know if the user input to any graphic component associated to this field should be allowed or not.

Parameters:
isReadOnly - if the graphic component associated to this field should be readOnly or not
Returns:
DynField that define the type of elements.

getElementsType

DynField getElementsType()
When a field is of type container, this method return a DynClass that define the type of elements. When the type is DYNOBJECT return the DynClass associated to this. Return null if the type not is a container.

Returns:
DynField that define the type of elements.

setElementsType

DynField setElementsType(int type)
                         throws DynFieldIsNotAContainerException
Set the type of items when the field is a container. El tipo de los elementos de un container esta definido mediante un DynField, que crea con el tipo pasado por parametro y lo devuelve este metodo.

Parameters:
tipo - de los elementos
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException

setElementsType

DynField setElementsType(DynStruct type)
                         throws DynFieldIsNotAContainerException
Set the type of items when the field is a container. Metodo de utilidad que establece el typo de DYNOBJECT y methe como subtipo el DynStruct pasado como parametro.

Parameters:
tipo - de los elementos
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException

validate

void validate(Object value)
              throws DynFieldValidateException
Validate that the value match the properties of the field.

Parameters:
value -
Throws:
DynFieldValidateException

coerce

Object coerce(Object value)
              throws CoercionException
Force the type of value to the type of the field.

Parameters:
value -
Returns:
new value
Throws:
CoercionException

getTheTypeOfAvailableValues

int getTheTypeOfAvailableValues()
Deprecated. don't use, check minValue/maxValue and getAvailableValues instead


setDefaultDynValue

DynField setDefaultDynValue(Object defaultValue)
Deprecated. use instead setDefaultFieldValue(Object)


setTheTypeOfAvailableValues

DynField setTheTypeOfAvailableValues(int type)
Deprecated. don't use, set minValue/maxValue and availableValues instead



Copyright © 2004-2011 gvSIG. All Rights Reserved.