org.rapla.entities.dynamictype
Interface Attribute

All Superinterfaces:
Annotatable, MultiLanguageNamed, Named, RaplaObject

public interface Attribute
extends RaplaObject, MultiLanguageNamed, Annotatable

Attributes are to DynamicTypes, what properties are to Beans. Currently Rapla supports the following types:

  • string
  • int
  • date
  • boolean
  • rapla:category
  • See Also:
    DynamicType

    Field Summary
    static Attribute[] ATTRIBUTE_ARRAY
               
    static RaplaType TYPE
               
     
    Method Summary
     Object convertValue(Object oldValue)
              converts the passed value to fit the attributes type.
     Object defaultValue()
               
     Object getConstraint(String key)
               
     Class getConstraintClass(String key)
               
     String[] getConstraintKeys()
               
     DynamicType getDynamicType()
               
     String getKey()
              The Key is identifier in string-form.
     AttributeType getType()
               
     boolean isOptional()
               
     boolean isValid(Object object)
               
     boolean needsChange(Object value)
              Checks if the passed value matches the attribute type or needs conversion.
     void setConstraint(String key, Object constraint)
               
     void setKey(String key)
               
     void setOptional(boolean bOptional)
               
     void setType(AttributeType type)
              Set the type of the Attribute.
     
    Methods inherited from interface org.rapla.entities.RaplaObject
    getRaplaType
     
    Methods inherited from interface org.rapla.entities.MultiLanguageNamed
    getName
     
    Methods inherited from interface org.rapla.entities.Named
    getName
     
    Methods inherited from interface org.rapla.entities.Annotatable
    getAnnotation, getAnnotation, getAnnotationKeys, setAnnotation
     

    Field Detail

    TYPE

    static final RaplaType TYPE

    ATTRIBUTE_ARRAY

    static final Attribute[] ATTRIBUTE_ARRAY
    Method Detail

    getType

    AttributeType getType()

    setType

    void setType(AttributeType type)
    Set the type of the Attribute. Warning: Changing the type after initialization can lead to data loss, if there are already classifications that use this attribute and the classification value can't be converted to the new type. Example a non numerical string can't be converted to an int.


    setKey

    void setKey(String key)

    getKey

    String getKey()
    The Key is identifier in string-form. Keys could be helpfull for interaction with other modules. An Invoice-Plugin could work on attributes with a "price" key. Keys also allow for a better readability of the XML-File. Changing of a key is possible, but should be used with care.


    defaultValue

    Object defaultValue()

    convertValue

    Object convertValue(Object oldValue)
    converts the passed value to fit the attributes type. Example Conversions are:


    needsChange

    boolean needsChange(Object value)
    Checks if the passed value matches the attribute type or needs conversion.

    See Also:
    convertValue(java.lang.Object)

    isValid

    boolean isValid(Object object)

    isOptional

    boolean isOptional()

    setOptional

    void setOptional(boolean bOptional)

    getConstraint

    Object getConstraint(String key)

    getConstraintClass

    Class getConstraintClass(String key)

    setConstraint

    void setConstraint(String key,
                       Object constraint)

    getConstraintKeys

    String[] getConstraintKeys()

    getDynamicType

    DynamicType getDynamicType()


    Copyright © 2000-2006 Rapla Team. All Rights Reseserved.