org.gvsig.tools.dynobject.impl
Class DefaultDynField

java.lang.Object
  extended by org.gvsig.tools.dynobject.impl.DefaultDynField
All Implemented Interfaces:
DynField

public class DefaultDynField
extends Object
implements DynField


Nested Class Summary
static class DefaultDynField.CheckDynFieldListException
           
 
Field Summary
 
Fields inherited from interface org.gvsig.tools.dynobject.DynField
ANY, CHOICE, RANGE
 
Constructor Summary
DefaultDynField(String name)
           
DefaultDynField(String name, int dataType, Object defaultValue, boolean persistent, boolean mandatory)
           
 
Method Summary
 void check()
           
 Object coerce(Object value)
          Force the type of value to the type of the field.
 boolean equals(Object obj)
           
 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()
           
 int getType()
          Return the type used in this field.
 boolean getValidateElements()
           
 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[] availableValues)
           
 DynField setAvailableValues(List availableValues)
           
 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)
           
 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)
           
 DynField setType(DataType dataType)
           
 DynField setType(int dataType)
          Sets the type of the field.
 DynField setValidateElements(boolean validate)
           
 String toString()
           
 void validate(Object value)
          Validate that the value match the properties of the field.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDynField

public DefaultDynField(String name)

DefaultDynField

public DefaultDynField(String name,
                       int dataType,
                       Object defaultValue,
                       boolean persistent,
                       boolean mandatory)
Method Detail

check

public void check()
           throws ListBaseException
Throws:
ListBaseException

toString

public String toString()
Overrides:
toString in class Object

getName

public String getName()
Description copied from interface: DynField
Return the name of the field.

Specified by:
getName in interface DynField
Returns:
name of the field

setDescription

public DynField setDescription(String description)
Description copied from interface: DynField
Sets the description asociated to this field.

Specified by:
setDescription in interface DynField
Returns:
this same DynField object

getDescription

public String getDescription()
Description copied from interface: DynField
Return the descripcion associated to this field.

Specified by:
getDescription in interface DynField
Returns:
the description of the field.

setType

public DynField setType(int dataType)
Description copied from interface: DynField
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".

Specified by:
setType in interface DynField
Returns:
this same DynField object

setType

public DynField setType(DataType dataType)
Specified by:
setType in interface DynField

getType

public int getType()
Description copied from interface: DynField
Return the type used in this field. The values of type is the same of DataTypes

Specified by:
getType in interface DynField
Returns:

getDataType

public DataType getDataType()
Specified by:
getDataType in interface DynField

setSubtype

public DynField setSubtype(String subtype)
Description copied from interface: DynField
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.

Specified by:
setSubtype in interface DynField
Returns:
this same DynField object

getSubtype

public String getSubtype()
Description copied from interface: DynField
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.

Specified by:
getSubtype in interface DynField
Returns:
the subtype of the field.

setDefaultDynValue

public DynField setDefaultDynValue(Object defaultValue)
Specified by:
setDefaultDynValue in interface DynField

getDefaultValue

public Object getDefaultValue()
Description copied from interface: DynField
Return the default value used in creation of new objects with this field.

Specified by:
getDefaultValue in interface DynField
Returns:
defaulr value to use for this field.

setAvailableValues

public DynField setAvailableValues(DynObjectValueItem[] availableValues)
Specified by:
setAvailableValues in interface DynField

setAvailableValues

public DynField setAvailableValues(List availableValues)
Specified by:
setAvailableValues in interface DynField

getAvailableValues

public DynObjectValueItem[] getAvailableValues()
Description copied from interface: DynField
Return the available values for this field. When assign a value to the field, this value need that exists in this list.

Specified by:
getAvailableValues in interface DynField
Returns:
an array of the available values for the field.

setMinValue

public DynField setMinValue(Object minValue)
Specified by:
setMinValue in interface DynField

getMinValue

public Object getMinValue()
Specified by:
getMinValue in interface DynField

setMaxValue

public DynField setMaxValue(Object maxValue)
Specified by:
setMaxValue in interface DynField

getMaxValue

public Object getMaxValue()
Specified by:
getMaxValue in interface DynField

isMandatory

public boolean isMandatory()
Description copied from interface: DynField
Return true if this field is mandatory.

Specified by:
isMandatory in interface DynField

isPersistent

public boolean isPersistent()
Description copied from interface: DynField
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.

Specified by:
isPersistent in interface DynField
Returns:
if the field is to be persisted or not

setMandatory

public DynField setMandatory(boolean mandatory)
Specified by:
setMandatory in interface DynField

setPersistent

public DynField setPersistent(boolean persistent)
Description copied from interface: DynField
Sets if the field must be persisted or not.

Specified by:
setPersistent in interface DynField
Parameters:
persistent - if the field must be persisted or not
Returns:
this same DynField object
See Also:
DynField.isPersistent()

setTheTypeOfAvailableValues

public DynField setTheTypeOfAvailableValues(int type)
Specified by:
setTheTypeOfAvailableValues in interface DynField

getTheTypeOfAvailableValues

public int getTheTypeOfAvailableValues()
Specified by:
getTheTypeOfAvailableValues in interface DynField

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getClassOfValue

public Class getClassOfValue()
Description copied from interface: DynField
Return the java class of the value of the field.

Specified by:
getClassOfValue in interface DynField
Returns:
the class of the value

setValidateElements

public DynField setValidateElements(boolean validate)

getValidateElements

public boolean getValidateElements()

setClassOfValue

public DynField setClassOfValue(Class theClass)
                         throws DynFieldIsNotAContainerException
Description copied from interface: DynField
Sets the class used for the values of the field.

Specified by:
setClassOfValue in interface DynField
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException

setElementsType

public DynField setElementsType(int type)
                         throws DynFieldIsNotAContainerException
Description copied from interface: DynField
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.

Specified by:
setElementsType in interface DynField
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException

setElementsType

public DynField setElementsType(DynStruct type)
                         throws DynFieldIsNotAContainerException
Description copied from interface: DynField
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.

Specified by:
setElementsType in interface DynField
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException

isContainer

public boolean isContainer()
Description copied from interface: DynField
Return true if the value of this field is a container. This method uses the same criteria of the DataType

Specified by:
isContainer in interface DynField
Returns:
true if the field type is a container

getElementsType

public DynField getElementsType()
Description copied from interface: DynField
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.

Specified by:
getElementsType in interface DynField
Returns:
DynField that define the type of elements.

validate

public void validate(Object value)
              throws DynFieldValidateException
Description copied from interface: DynField
Validate that the value match the properties of the field.

Specified by:
validate in interface DynField
Throws:
DynFieldValidateException

coerce

public Object coerce(Object value)
              throws CoercionException
Description copied from interface: DynField
Force the type of value to the type of the field.

Specified by:
coerce in interface DynField
Returns:
new value
Throws:
CoercionException

getGroup

public String getGroup()
Description copied from interface: DynField
Return a string that identify a group for this field. The groups are defined by the client of the field.

Specified by:
getGroup in interface DynField
Returns:
the group of the field

setGroup

public DynField setGroup(String groupName)
Specified by:
setGroup in interface DynField

getOder

public int getOder()
Description copied from interface: DynField
Return the ordinal that identify the order of this field in the DynObject.

Specified by:
getOder in interface DynField
Returns:
the order of field in the DynObject

setOrder

public DynField setOrder(int order)
Specified by:
setOrder in interface DynField

isHidden

public boolean isHidden()
Description copied from interface: DynField
Inform if this field can be visible or not for the user. This value don't affect the access through the API.

Specified by:
isHidden in interface DynField
Returns:
true if the field is hidden for the user.

setHidden

public DynField setHidden(boolean hidden)
Specified by:
setHidden in interface DynField

isReadOnly

public boolean isReadOnly()
Description copied from interface: DynField
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.

Specified by:
isReadOnly in interface DynField
Returns:
if the graphic component associated to this field should be readOnly or not

setReadOnly

public DynField setReadOnly(boolean isReadOnly)
Description copied from interface: DynField
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.

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

getClassOfItems

public Class getClassOfItems()
Description copied from interface: DynField
If the field is a container (List, Map or Set) return the java class of its items.

Specified by:
getClassOfItems in interface DynField
Returns:
the class of the items

setDefaultFieldValue

public DynField setDefaultFieldValue(Object defaultValue)
Description copied from interface: DynField
Set the default value used for this field when a new object with this field is created.

Specified by:
setDefaultFieldValue in interface DynField
Returns:
this same DynField object

setClassOfItems

public DynField setClassOfItems(Class theClass)
                         throws DynFieldIsNotAContainerException
Description copied from interface: DynField
If field type is List, Set or Map, this class is the class of items.

Specified by:
setClassOfItems in interface DynField
Returns:
this same DynField object
Throws:
DynFieldIsNotAContainerException


Copyright © 2004-2011 gvSIG. All Rights Reserved.