Tags:
create new tag
, view all tags
-- PedroRio - 30 Dec 2010

AttributeHandler - Dealing with Attributes

The attributeHandler class is responsible for managing a single attribute in the a given boObject instance. In a XEO Model, each attribute is of a given type but in the Java API the attributeHandler class is responsible for dealing with all of them (except collection attributes, for that use the bridgeHandler ). This means an attributeHandler class has methods to retrieve and set the value of the attribute with different types (it's up to the developer to know an attribute's type). It's possible, however, to check the attribute model definition for its data type.

In the following sections the most important methods of the API will be presented.

Reading attribute value

These methods allow to read the value of a given attribute (attributes have different data types)

Method Description Parameters Return Type Notes
getValueBoolean Returns the value of the attribute as a boolean (throws exception if value cannot be converted to boolean) - boolean  
getValueString Returns the value of the attribute as a string (throws exception if value cannot be converted to string) - String  
getValueLong Returns the value of the attribute as a long (throws exception if value cannot be converted to long) - Long  
getValueDouble Returns the value of the attribute as a double (throws exception if value cannot be converted to double) - Double  
getValueIFile Returns the value of the attribute as a IFile (throws exception if value cannot be converted to Ifile) - IFile  
getValueDate Returns the value of the attribute as a Date (throws exception if value cannot be converted to Date) - Date  
getValueObject Returns the value of the attribute as a raw java object - Object  

__

Setting the attribute value

These methods allow to set the value of a given attribute

Method name Description Parameters Return type Notes
setValueBoolean Set the value of the attribute as a boolean Boolean value void  
setValueString Set the value of the attribute as a string String value void  
setValueLong Set the value of the attribute as a long Long value void  
setValueDouble Set the value of the attribute as a double Double value void  
setValueDate Set the value of the attribute as a date Date value void  
setValueIFile Set the value of the attribute as an ifile IFile value void  
setValueObject Set the value of the attribute as a raw java object Object value void  

_

Definition

The methods allow to retrieve handlers or values that are related to the XEO Model definition of the attribute

Method Name Description Parameters Return type Notes
getDefAttribute Retrieves the attribute definition handler for the current attribute - boDefAttribute  
getName Retrieves the name of the attribute (not the label) in the definition - String  

__

Attribute Behavior

These methods allow to query the attribute handler for the result of certain behaviors.

Method name Description Parameters Return type Notes
hiddenWhen Returns whether the attribute should be hidden (evaluates user code defined in the object model) - boolean  
disableWhen Returns whether the attribute should be disabled (evaluates user code defined in the object model) - boolean  
required Returns whether the attribute should be required (evaluates user code defined in the object model) - boolean  
valid Returns whether the attribute's value is valid (evaluates user code defined in the object model) - boolean  
haveDefaultValue Returns whether the attribute has a default value or not - boolean  
defaultValue Returns the attribute's default value (evaluates user code defined in the object model) - String The default value for an attribute must always be a string which is convertible to the attribute's native format (example, the default value for a attribute of type date must be a string which can be parsed as a java.util.Date)
isDisabled Returns whether the attribute is disabled or not - boolean  
setDisabled Sets the attribute as disabled - void  
setInvalid Marks the attribute has invalid - void  

_

Topic revision: r4 - 2011-04-04 - NicolauGrosskopf
 

No permission to view TWiki.WebTopBar

This site is powered by the TWiki collaboration platform Powered by Perl

No permission to view TWiki.WebBottomBar