Class DefaultBindableElement

java.lang.Object
org.tentackle.bind.DefaultBindableElement
All Implemented Interfaces:
BindableElement

public class DefaultBindableElement extends Object implements BindableElement
A bindable element.

Bindable elements are annotated by the @Bindable-annotation.

Author:
harald
  • Constructor Details

    • DefaultBindableElement

      public DefaultBindableElement(String camelName)
      Creates a bindable element.
      Parameters:
      camelName - the member name in camelCase
  • Method Details

    • getCamelName

      public String getCamelName()
      Description copied from interface: BindableElement
      Gets the camelcase name of this element.
      Specified by:
      getCamelName in interface BindableElement
      Returns:
      the camelcase name
    • setCamelName

      public void setCamelName(String camelName)
      Description copied from interface: BindableElement
      Sets the camelcase name of this element.
      Specified by:
      setCamelName in interface BindableElement
      Parameters:
      camelName - the name in camelcase
    • getOrdinal

      public int getOrdinal()
      Description copied from interface: BindableElement
      Gets the ordinal for sorting.
      Specified by:
      getOrdinal in interface BindableElement
      Returns:
      the ordinal, defaults to 0
    • setOrdinal

      public void setOrdinal(int ordinal)
      Description copied from interface: BindableElement
      Sets the ordinal for sorting.
      Specified by:
      setOrdinal in interface BindableElement
      Parameters:
      ordinal - the ordinal
    • getBindingOptions

      public String getBindingOptions()
      Description copied from interface: BindableElement
      Gets the binding options.
      Specified by:
      getBindingOptions in interface BindableElement
      Returns:
      the binding options, null or empty if none
    • setBindingOptions

      public void setBindingOptions(String options)
      Description copied from interface: BindableElement
      Sets the binding options.
      Specified by:
      setBindingOptions in interface BindableElement
      Parameters:
      options - the options (separated by commas)
    • addBindingOptions

      public void addBindingOptions(String options)
      Description copied from interface: BindableElement
      Adds binding options.
      Specified by:
      addBindingOptions in interface BindableElement
      Parameters:
      options - the options to add
      See Also:
    • getField

      public Field getField()
      Description copied from interface: BindableElement
      Gets the bound field.
      Specified by:
      getField in interface BindableElement
      Returns:
      the field, null if none
    • setField

      public void setField(Field field)
      Description copied from interface: BindableElement
      Sets the bound field.
      Specified by:
      setField in interface BindableElement
      Parameters:
      field - the field, null to clear
    • getGetter

      public Method getGetter()
      Description copied from interface: BindableElement
      Gets the getter method.
      Specified by:
      getGetter in interface BindableElement
      Returns:
      the method, null if none
    • setGetter

      public void setGetter(Method getter)
      Description copied from interface: BindableElement
      Sets the getter method.
      Specified by:
      setGetter in interface BindableElement
      Parameters:
      getter - the getter method, null to clear
    • getSetter

      public Method getSetter()
      Description copied from interface: BindableElement
      Gets the setter method.
      Specified by:
      getSetter in interface BindableElement
      Returns:
      the setter method, null if none
    • setSetter

      public void setSetter(Method setter)
      Description copied from interface: BindableElement
      Sets the setter method.
      Specified by:
      setSetter in interface BindableElement
      Parameters:
      setter - the setter, null to clear
    • getFrom

      public Method getFrom()
      Description copied from interface: BindableElement
      Gets the "from"-method.
      Members of immutable objects may provide a from method that takes the new member value as its argument and returns a new immutable object that will be set as the parent member's value.
      Specified by:
      getFrom in interface BindableElement
      Returns:
      the "from"-method, null if none
    • setFrom

      public void setFrom(Method from)
      Description copied from interface: BindableElement
      Sets the "from"-method.
      Specified by:
      setFrom in interface BindableElement
      Parameters:
      from - the "from"-method, null to clear
    • getObject

      public Object getObject(Object parent)
      Description copied from interface: BindableElement
      Gets the object of this element.
      Specified by:
      getObject in interface BindableElement
      Parameters:
      parent - the parent containing this element
      Returns:
      the object of this member
    • setObject

      public Object setObject(Object parent, Object value)
      Description copied from interface: BindableElement
      Sets the object of this member.
      The method does nothing if the element is readonly.
      Specified by:
      setObject in interface BindableElement
      Parameters:
      parent - the parent containing this member
      value - the object to set
      Returns:
      the new parent if value was updated via "from"- or "with"-method
    • isReadOnly

      public boolean isReadOnly()
      Description copied from interface: BindableElement
      Returns whether element is read only.
      Specified by:
      isReadOnly in interface BindableElement
      Returns:
      true if not a field and no setter or from method
    • getType

      public Class<?> getType()
      Description copied from interface: BindableElement
      Gets the type of the member.
      Specified by:
      getType in interface BindableElement
      Returns:
      the class
    • getGenericType

      public Type getGenericType()
      Description copied from interface: BindableElement
      Gets the generic type of the member.
      Specified by:
      getGenericType in interface BindableElement
      Returns:
      the generic type