Class BeanProperty

java.lang.Object
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 Details

  • Constructor Details

    • BeanProperty

      public BeanProperty(String name, DataType dataType, double size, boolean required, String controlType, boolean readOnly)
      Constructs a bean property definition
      Parameters:
      name - the name of the property
      dataType - the type of the property
      size - the size
      required - flag true if required
      controlType - string indication which type of control to use
      readOnly - flag true if read-only
    • BeanProperty

      public BeanProperty(String name, DataType dataType, double size, boolean required, String controlType)
      Constructs a bean property definition
      Parameters:
      name - the name of the property
      dataType - the type of the property
      size - the size
      required - flag true if required
      controlType - string indication which type of control to use
    • BeanProperty

      public BeanProperty(String name, DataType dataType, double size, boolean required)
      Constructs a bean property definition
      Parameters:
      name - the name of the property
      dataType - the type of the property
      size - the size
      required - flag true if required
  • Method Details

    • getEntity

      public Entity getEntity()
      Description copied from interface: Column
      Returns the EntityType that this Column belongs to
      Specified by:
      getEntity in interface Column
      Returns:
      the EntityType if any
    • 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:
    • 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
    • setAttribute

      public <T extends ColumnExpr> T setAttribute(String name, Object value)
      Sets an attribute for this column
      Specified by:
      setAttribute in interface ColumnExpr
      Type Parameters:
      T - the column expression type
      Parameters:
      name - the attribute name
      value - the attribute value
      Returns:
      the column itself
    • getAttributes

      public Set<Attributes.Attribute> getAttributes()
      Returns all metadata attributes.
      Specified by:
      getAttributes in interface Column
      Returns:
      set of metadata attributes
    • 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
    • getEnumType

      public Class<Enum<?>> getEnumType()
      Returns the enum type for this column

      Specified by:
      getEnumType in interface ColumnExpr
      Returns:
      the enum type
    • 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
    • getUpdateColumn

      public Column getUpdateColumn()
      Description copied from interface: ColumnExpr
      Returns the underlying source column (if any). If an expression is based not based on a particutlar column this function returns null.
      Specified by:
      getUpdateColumn in interface ColumnExpr
      Returns:
      the column on which this expression is based or null if not applicable.
    • getSourceColumn

      @Deprecated public final Column getSourceColumn()
      Deprecated.
      Use getUpdateColumn() instead!
      Specified by:
      getSourceColumn in interface ColumnExpr
    • 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
    • validateValue

      public Object validateValue(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:
      validateValue in interface Column
      Parameters:
      value - the value to validate
      Returns:
      the value the validated and possibly converted value
    • 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)