Class CommonOptionsImpl

java.lang.Object
org.tentackle.model.impl.CommonOptionsImpl
All Implemented Interfaces:
Cloneable, CommonOptions
Direct Known Subclasses:
AttributeOptionsImpl, EntityOptionsImpl

public abstract class CommonOptionsImpl extends Object implements CommonOptions, Cloneable
Implementation of common options.
Author:
harald
  • Field Details

  • Constructor Details

    • CommonOptionsImpl

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

    • clone

      protected CommonOptionsImpl clone()
      Clones the options.
      Protected since subclasses' clone() methods are protected to enforce invocation via special clone methods with additional arguments.
      Overrides:
      clone in class Object
      Returns:
      the cloned options
    • getSourceInfo

      public SourceInfo getSourceInfo()
      Gets the source info.
      Returns:
      the info, null if unknown
    • applyOption

      public boolean applyOption(String option, Boolean ctrl) throws ModelException
      Applies given option string.
      Parameters:
      option - the option string
      ctrl - option control: true if turn option on, false if option off, null if on/off missing (defaults to on)
      Returns:
      true if applied, false if unknown option
      Throws:
      ModelException - if applying the option failed
    • processOption

      public boolean processOption(String option) throws ModelException
      Processes an option string.
      If the option string starts with ! or -, the option is considered to be turned off. If the option starts with '+' it is forced to be turned on. In all other cases it is left to the implementation of applyOption(java.lang.String, java.lang.Boolean) how the option should be treated.
      Parameters:
      option - the option string
      Returns:
      true if option applied, false if not known
      Throws:
      ModelException - if option malformed
    • processBindOption

      public void processBindOption(String option, boolean on)
      Processes a bind option.
      Parameters:
      option - the bind option
      on - true to add, else remove the option
    • getComment

      public String getComment()
      Description copied from interface: CommonOptions
      The comment.
      Specified by:
      getComment in interface CommonOptions
      Returns:
      the comment
    • setComment

      public void setComment(String comment)
      Sets the comment.
      Parameters:
      comment - the comment
    • getStereotypes

      public List<String> getStereotypes()
      Description copied from interface: CommonOptions
      Gets the list of custom stereotypes.
      Specified by:
      getStereotypes in interface CommonOptions
      Returns:
      the stereotypes
    • setStereotypes

      public void setStereotypes(List<String> stereotypes)
    • getBindOptions

      public String getBindOptions()
      Description copied from interface: CommonOptions
      The bind options.
      Specified by:
      getBindOptions in interface CommonOptions
      Returns:
      the bind options
    • setBindOptions

      public void setBindOptions(String bindOptions)
    • addBindOption

      public void addBindOption(String option)
      Adds a bind option.
      Parameters:
      option - the option
    • removeBindOption

      public void removeBindOption(String option)
      Removes a bind option.
      Parameters:
      option - the option
    • isNoDeclare

      public boolean isNoDeclare()
      Description copied from interface: CommonOptions
      No declaration code.
      Specified by:
      isNoDeclare in interface CommonOptions
      Returns:
      true if don't generate declaration
    • isNoMethod

      public boolean isNoMethod()
      Description copied from interface: CommonOptions
      No getter and setter methods.
      Specified by:
      isNoMethod in interface CommonOptions
      Returns:
      true if no accessor methods must be generated
    • isNoConstant

      public boolean isNoConstant()
      Description copied from interface: CommonOptions
      No constant strings.
      Specified by:
      isNoConstant in interface CommonOptions
      Returns:
      true if no name constants must be generated
    • isMute

      public boolean isMute()
      Description copied from interface: CommonOptions
      Element is mute.
      Specified by:
      isMute in interface CommonOptions
      Returns:
      true if not part of the pdo
    • isFromSuper

      public boolean isFromSuper()
      Description copied from interface: CommonOptions
      Declared in super class.
      Specified by:
      isFromSuper in interface CommonOptions
      Returns:
      true if element is derived from the super class
    • isReadOnly

      public boolean isReadOnly()
      Description copied from interface: CommonOptions
      Element is read-only.
      Specified by:
      isReadOnly in interface CommonOptions
      Returns:
      true if element cannot be modified
    • isWriteOnly

      public boolean isWriteOnly()
      Description copied from interface: CommonOptions
      Element is write-only.
      Specified by:
      isWriteOnly in interface CommonOptions
      Returns:
      true if element cannot be read by application
    • getAccessScope

      public AccessScope getAccessScope()
      Description copied from interface: CommonOptions
      The access scope.
      Specified by:
      getAccessScope in interface CommonOptions
      Returns:
      the scope
    • isTrimRead

      public boolean isTrimRead()
      Description copied from interface: CommonOptions
      Trim on read from database.
      Specified by:
      isTrimRead in interface CommonOptions
      Returns:
      true if string is trimmed when read
    • isTrimWrite

      public boolean isTrimWrite()
      Description copied from interface: CommonOptions
      Trim on write to database.
      Specified by:
      isTrimWrite in interface CommonOptions
      Returns:
      true if string is trimmed on write
    • isMapNull

      public boolean isMapNull()
      Description copied from interface: CommonOptions
      Map null values to constant in database.
      Specified by:
      isMapNull in interface CommonOptions
      Returns:
      true if map null to non-null value
    • isBindable

      public boolean isBindable()
      Description copied from interface: CommonOptions
      Generate bindable annotation.
      Specified by:
      isBindable in interface CommonOptions
      Returns:
      true if bindable element
    • setAccessScope

      public void setAccessScope(AccessScope accessScope)
    • setBindable

      public void setBindable(boolean bind)
    • setMute

      public void setMute(boolean mute)
    • setFromSuper

      public void setFromSuper(boolean fromSuper)
    • setMapNull

      public void setMapNull(boolean mapNull)
    • setNoConstant

      public void setNoConstant(boolean noConstant)
    • setNoDeclare

      public void setNoDeclare(boolean noDeclare)
    • setNoMethod

      public void setNoMethod(boolean noMethod)
    • setReadOnly

      public void setReadOnly(boolean readOnly)
    • setTrimRead

      public void setTrimRead(boolean trimRead)
    • setTrimWrite

      public void setTrimWrite(boolean trimWrite)
    • setWriteOnly

      public void setWriteOnly(boolean writeOnly)
    • isAutoSelect

      public boolean isAutoSelect()
      Description copied from interface: CommonOptions
      Returns whether autoselect should be turned on.
      Specified by:
      isAutoSelect in interface CommonOptions
      Returns:
      true if autoselect
    • setAutoSelect

      public void setAutoSelect(boolean autoSelect)
    • isLowerCase

      public boolean isLowerCase()
      Description copied from interface: CommonOptions
      Returns whether lowercase conversion requested.
      Specified by:
      isLowerCase in interface CommonOptions
      Returns:
      true if lowercase
    • setLowerCase

      public void setLowerCase(boolean lowerCase)
    • isMaxCol

      public boolean isMaxCol()
      Description copied from interface: CommonOptions
      Returns true whether the maxcol binding option should be applied.
      Specified by:
      isMaxCol in interface CommonOptions
      Returns:
      true if maxcol
    • setMaxCol

      public void setMaxCol(boolean maxCol)
    • isUpperCase

      public boolean isUpperCase()
      Description copied from interface: CommonOptions
      Returns whether uppercase conversion requested.
      Specified by:
      isUpperCase in interface CommonOptions
      Returns:
      true if uppercase
    • setUpperCase

      public void setUpperCase(boolean upperCase)
    • validate

      public void validate() throws ModelException
      Description copied from interface: CommonOptions
      Validates the options.
      Specified by:
      validate in interface CommonOptions
      Throws:
      ModelException - if validation failed
    • createModelException

      public ModelException createModelException(String message)