org.apache.empire.data.bean
Class BeanProperty

java.lang.Object
  extended by org.apache.empire.data.bean.BeanProperty
All Implemented Interfaces:
Column, ColumnExpr

public class BeanProperty
extends Object
implements Column

BeanObject This class defines Metadata for a single property.

Author:
Rainer

Field Summary
protected  BeanClass beanClass
           
 
Constructor Summary
BeanProperty(String name, DataType dataType, double size, boolean required)
          Constructs a bean property definition
BeanProperty(String name, DataType dataType, double size, boolean required, String controlType, boolean readOnly)
          Constructs a bean property definition
BeanProperty(String name, DataType dataType, double size, DataMode dataMode, String controlType)
          Constructs a bean property definition
 
Method Summary
 Object getAttribute(String name)
          Returns the value of a column attribute.
 BeanClass getBeanClass()
          returns the bean class of this property.
 String getBeanPropertyName()
          Gets the Java bean property name.
 String getControlType()
          Returns the columns control type.
 DataType getDataType()
          Returns the data type of the bean property.
 String getName()
          Returns the name of the property.
 Options getOptions()
          Returns the list of options for this column containing all allowed field values.
 double getSize()
          Returns the maximum size a value for this column is allowed to have.
 Column getSourceColumn()
          Returns the column This function should return the same string as getName()
 String getTitle()
          Returns the title attribute.
 boolean isAutoGenerated()
          Returns whether or not the value for this column is auto-generated
 boolean isReadOnly()
          Returns true if the values for this column are generally read only (like i.e.
 boolean isRequired()
          Returns whether or not the value for this column must be supplied (i.e.
 void setAttribute(String name, Object value)
           
 void setControlType(String controlType)
           
 void setOptions(Options options)
           
 void setTitle(String title)
           
 void validate(Object value)
          Checks if the given value is a valid value for this column If not, an exception is thrown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beanClass

protected BeanClass beanClass
Constructor Detail

BeanProperty

public BeanProperty(String name,
                    DataType dataType,
                    double size,
                    DataMode dataMode,
                    String controlType)
Constructs a bean property definition

Parameters:
name - the name of the property (case insensitive)
dataType - the data type
size - size depending on data type. For data type TEXT the maximum number of characters.
dataMode - determines whether this property is read only, optional, required or auto-generated
controlType - the control type to be used for editing this value. Depends on the client. Default is "text"

BeanProperty

public BeanProperty(String name,
                    DataType dataType,
                    double size,
                    boolean required,
                    String controlType,
                    boolean readOnly)
Constructs a bean property definition

Parameters:
name -
dataType -
size -
required -
controlType -
readOnly -

BeanProperty

public BeanProperty(String name,
                    DataType dataType,
                    double size,
                    boolean required)
Constructs a bean property definition

Parameters:
name -
dataType -
size -
required -
Method Detail

getName

public String getName()
Returns the name of the property.

Specified by:
getName in interface ColumnExpr
Returns:
the property name

getDataType

public DataType getDataType()
Returns the data type of the bean property.

Specified by:
getDataType in interface ColumnExpr
Returns:
the property data type
See Also:
DataType

getAttribute

public Object getAttribute(String name)
Returns the value of a column attribute. Column attributes are used to provide metadata for a property.

Specified by:
getAttribute in interface ColumnExpr
Parameters:
name - the attribute name
Returns:
value of the attribute if it exists or null otherwise

getTitle

public String getTitle()
Returns the title attribute.

Specified by:
getTitle in interface ColumnExpr
Returns:
the column title

getOptions

public Options getOptions()
Returns the list of options for this column containing all allowed field values.

Specified by:
getOptions in interface ColumnExpr
Returns:
the list of options

getControlType

public String getControlType()
Returns the columns control type. The control type is a client specific name for the type of input control that should be used to display and edit values for this column.

Specified by:
getControlType in interface ColumnExpr
Returns:
the columns control type

getBeanPropertyName

public String getBeanPropertyName()
Gets the Java bean property name. This function should return the same string as getName()

Specified by:
getBeanPropertyName in interface ColumnExpr
Returns:
the name of the bean property

getSourceColumn

public Column getSourceColumn()
Returns the column This function should return the same string as getName()

Specified by:
getSourceColumn in interface ColumnExpr
Returns:
the name of the bean property

getSize

public double getSize()
Description copied from interface: Column
Returns the maximum size a value for this column is allowed to have.

For the data type DECIMAL the size defines the scale and precision of the value.

Specified by:
getSize in interface Column
Returns:
Returns the maximum size a value for this column is allowed to have.

isReadOnly

public boolean isReadOnly()
Description copied from interface: Column
Returns true if the values for this column are generally read only (like i.e. for sequence generated values).

Specified by:
isReadOnly in interface Column
Returns:
Returns true if the values for this column are generally read-only

isAutoGenerated

public boolean isAutoGenerated()
Description copied from interface: Column
Returns whether or not the value for this column is auto-generated

Specified by:
isAutoGenerated in interface Column
Returns:
Returns true if the value for this column is auto-generated

isRequired

public boolean isRequired()
Description copied from interface: Column
Returns whether or not the value for this column must be supplied (i.e. it is mandatory) or not.

Specified by:
isRequired in interface Column
Returns:
Returns true if the value for this column must be supplied

validate

public void validate(Object value)
Description copied from interface: Column
Checks if the given value is a valid value for this column If not, an exception is thrown

Specified by:
validate in interface Column

getBeanClass

public BeanClass getBeanClass()
returns the bean class of this property.

Returns:
the BeanClass or null if BeanProperty is used 'stand alone'

setControlType

public void setControlType(String controlType)

setOptions

public void setOptions(Options options)

setTitle

public void setTitle(String title)

setAttribute

public void setAttribute(String name,
                         Object value)


Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.