Class AttributeOptionsImpl

java.lang.Object
org.tentackle.model.impl.CommonOptionsImpl
org.tentackle.model.impl.AttributeOptionsImpl
All Implemented Interfaces:
AttributeOptions, CommonOptions

public class AttributeOptionsImpl extends CommonOptionsImpl implements AttributeOptions
Author:
harald
  • Field Details

  • Constructor Details

    • AttributeOptionsImpl

      public AttributeOptionsImpl(Attribute attribute, SourceInfo sourceInfo)
      Creates attribute options.
      Parameters:
      attribute - the attribute
      sourceInfo - the source info, null if none
  • Method Details

    • getAttribute

      public AttributeImpl getAttribute()
      Description copied from interface: AttributeOptions
      Gets the attribute this option-set belongs to.
      Specified by:
      getAttribute in interface AttributeOptions
      Returns:
      the entity
    • applyEntityOptions

      public void applyEntityOptions(EntityOptions options, DataType<?> dataType)
      Sets the default from entity options.
      Parameters:
      options - the entity options
      dataType - the datatype of the attribute
    • applyOption

      public boolean applyOption(String option, Boolean ctrl) throws ModelException
      Description copied from class: CommonOptionsImpl
      Applies given option string.
      Overrides:
      applyOption in class CommonOptionsImpl
      Parameters:
      option - the option string
      ctrl - option control: true if turn option on, false if oprion off, null if on/off missing (defaults to on)
      Returns:
      true if applied, false if unknown option
      Throws:
      ModelException - if applying the option failed
    • getAnnotations

      public List<String> getAnnotations()
      Description copied from interface: AttributeOptions
      Gets the list of annotations.
      Annotations start with an @. By default, they are applied to the getters of the interfaces only. However, the at-sign may be followed by one or two modifiers that changes the code generation:
      • =: annotate setter only.
      • +: annotate setter and getter.
      • ~: annotation is hidden, i.e. applied to the implementations instead of the interfaces.
      Example:
         @=~MyAnno
         will be applied to the implementation of the setter only.
       
      Specified by:
      getAnnotations in interface AttributeOptions
      Returns:
      the annotations
    • getDefaultValue

      public Object getDefaultValue()
      Description copied from interface: AttributeOptions
      Gets the default value if [DEFAULT value] given.
      The returned type corresponds to the DataType of the Attribute.
      Specified by:
      getDefaultValue in interface AttributeOptions
      Returns:
      the defaultValue
    • getInitialValue

      public String getInitialValue()
      Description copied from interface: AttributeOptions
      Gets the initial value if [INIT value] given.
      Specified by:
      getInitialValue in interface AttributeOptions
      Returns:
      the string to initialize the declaration with
    • setAnnotations

      public void setAnnotations(List<String> annotations)
    • setDefaultValue

      public void setDefaultValue(Object defaultValue)
    • setInitialValue

      public void setInitialValue(String initialValue)
    • isContextId

      public boolean isContextId()
      Description copied from interface: AttributeOptions
      Returns whether this is the object id holding the context.
      Specified by:
      isContextId in interface AttributeOptions
      Returns:
      true if context id
    • setContextId

      public void setContextId(boolean contextId)
    • isDomainKey

      public boolean isDomainKey()
      Description copied from interface: AttributeOptions
      Returns whether this is a unique domain key (or part of it).
      Specified by:
      isDomainKey in interface AttributeOptions
      Returns:
      true if domain key
    • setDomainKey

      public void setDomainKey(boolean domainKey)
    • isUTC

      public boolean isUTC()
      Description copied from interface: AttributeOptions
      Returns whether this is a UTC timestamp.
      Specified by:
      isUTC in interface AttributeOptions
      Returns:
      true if UTC
    • setUTC

      public void setUTC(boolean utc)
    • isWithTimezone

      public boolean isWithTimezone()
      Description copied from interface: AttributeOptions
      Returns whether to use a dedicated timezone.
      If set, the PDO must provide a method to configure the timezone for the given attribute of the form:
       Calendar get<attribute-name>TimezoneConfig();
      
       Example: Calendar getPrintedTimezoneConfig();
       
      Specified by:
      isWithTimezone in interface AttributeOptions
      Returns:
      true if with timezone
    • setWithTimezone

      public void setWithTimezone(boolean withTimezone)
    • isUnsigned

      public boolean isUnsigned()
      Description copied from interface: AttributeOptions
      Returns whether this is an unsigned numeric field.
      Specified by:
      isUnsigned in interface AttributeOptions
      Returns:
      true if unsigned
    • setUnsigned

      public void setUnsigned(boolean unsigned)
    • isDigitsOnly

      public boolean isDigitsOnly()
      Description copied from interface: AttributeOptions
      Returns whether only digits are allowed as input.
      Applies only to strings. Number types provide their own rules.
      Specified by:
      isDigitsOnly in interface AttributeOptions
      Returns:
      true if allow only digits
    • setDigitsOnly

      public void setDigitsOnly(boolean digitsOnly)
    • isHidden

      public boolean isHidden()
      Description copied from interface: AttributeOptions
      Returns whether the attribute is not declared in the interface.
      Specified by:
      isHidden in interface AttributeOptions
      Returns:
      true if implemented only, no public interface definition
    • setHidden

      public void setHidden(boolean hidden)
    • isShallow

      public boolean isShallow()
      Description copied from interface: AttributeOptions
      Returns whether the attribute should be skipped in snapshot and copy operations.
      Specified by:
      isShallow in interface AttributeOptions
      Returns:
      true if skip this attribute, false to include (default)
    • setShallow

      public void setShallow(boolean shallow)
    • isPartOfNormText

      public boolean isPartOfNormText()
      Description copied from interface: AttributeOptions
      Returns whether the attribute becomes part of the normtext.
      Specified by:
      isPartOfNormText in interface AttributeOptions
      Returns:
      true if add to normtext
    • setPartOfNormText

      public void setPartOfNormText(boolean partOfNormText)
    • createModelException

      public ModelException createModelException(String message)
      Overrides:
      createModelException in class CommonOptionsImpl