- java.lang.Object
-
- org.tentackle.model.impl.CommonOptionsImpl
-
- All Implemented Interfaces:
CommonOptions
- Direct Known Subclasses:
AttributeOptionsImpl,EntityOptionsImpl
public abstract class CommonOptionsImpl extends java.lang.Object implements CommonOptions
Implementation of common options.- Author:
- harald
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBIND_SIZEset max columns and/or scale.static java.lang.StringOPTION_BINDadd binding information.static java.lang.StringOPTION_DERIVEDattribute is derived (table per class).static java.lang.StringOPTION_MAPNULLmap null to non-null value.static java.lang.StringOPTION_NOCONSTANTdon't generate static constants.static java.lang.StringOPTION_NODECLAREdon't generate declaration.static java.lang.StringOPTION_NOMETHODdon't generate accessor methods.static java.lang.StringOPTION_READONLYdon't generate a set-method.static java.lang.StringOPTION_SETGETalways use set/get, don't use attributes directly in read/write.static java.lang.StringOPTION_SUPERattribute is derived (table per concrete class).static java.lang.StringOPTION_TRIMtrim on read and write.static java.lang.StringOPTION_TRIM_READtrim string on read.static java.lang.StringOPTION_TRIM_WRITEtrim string on write.static java.lang.StringOPTION_WRITEONLYdon't generate a get-method.
-
Constructor Summary
Constructors Constructor Description CommonOptionsImpl(SourceInfo sourceInfo)Creates options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBindOption(java.lang.String option)Adds a bind option.booleanapplyOption(java.lang.String option, java.lang.Boolean ctrl)Applies given option string.ModelExceptioncreateModelException(java.lang.String message)AccessScopegetAccessScope()The access scope.java.lang.StringgetBindOptions()The bind options.java.lang.StringgetComment()The comment.SourceInfogetSourceInfo()Gets the source info.booleanisAutoSelect()Returns whether autoselect should be turned on.booleanisBind()true if [BIND]-option set.booleanisDerived()true if [DERIVED]-option set.booleanisFromSuper()true if [SUPER]-option set.booleanisLowerCase()Returns whether lowercase conversion requested.booleanisMapNull()true if [MAPNULL]-option set.booleanisMaxCol()Returns true whether the maxcol binding option should be applied.booleanisNoConstant()true if [NOCONSTANT]-option set.booleanisNoDeclare()true if [NODECLARE]-option set.booleanisNoMethod()true if [NOMETHOD]-option set.booleanisReadOnly()true if [READONLY]-option set.booleanisSetGet()true if [SETGET]-option set.booleanisTrimRead()true if [TRIMREAD]-option set.booleanisTrimWrite()true if [TRIMWRITE]-option set.booleanisUpperCase()Returns whether uppercase conversion requested.booleanisWriteOnly()true if [WRITEONLY]-option set.voidprocessBindOption(java.lang.String option, boolean on)Processes a bind option.booleanprocessOption(java.lang.String option)Processes an option string.
If the option string starts with ! or -, the option is considered to be turned off.voidremoveBindOption(java.lang.String option)Removes a bind option.voidsetAccessScope(AccessScope accessScope)voidsetAutoSelect(boolean autoSelect)voidsetBind(boolean bind)voidsetBindOptions(java.lang.String bindOptions)voidsetComment(java.lang.String comment)Sets the comment.voidsetDerived(boolean derived)voidsetFromSuper(boolean fromSuper)voidsetLowerCase(boolean lowerCase)voidsetMapNull(boolean mapNull)voidsetMaxCol(boolean maxCol)voidsetNoConstant(boolean noConstant)voidsetNoDeclare(boolean noDeclare)voidsetNoMethod(boolean noMethod)voidsetReadOnly(boolean readOnly)voidsetSetGet(boolean setGet)voidsetTrimRead(boolean trimRead)voidsetTrimWrite(boolean trimWrite)voidsetUpperCase(boolean upperCase)voidsetWriteOnly(boolean writeOnly)voidvalidate()Validates the options.
-
-
-
Field Detail
-
OPTION_NODECLARE
public static final java.lang.String OPTION_NODECLARE
don't generate declaration.- See Also:
- Constant Field Values
-
OPTION_NOMETHOD
public static final java.lang.String OPTION_NOMETHOD
don't generate accessor methods.- See Also:
- Constant Field Values
-
OPTION_NOCONSTANT
public static final java.lang.String OPTION_NOCONSTANT
don't generate static constants.- See Also:
- Constant Field Values
-
OPTION_DERIVED
public static final java.lang.String OPTION_DERIVED
attribute is derived (table per class).- See Also:
- Constant Field Values
-
OPTION_SUPER
public static final java.lang.String OPTION_SUPER
attribute is derived (table per concrete class).- See Also:
- Constant Field Values
-
OPTION_READONLY
public static final java.lang.String OPTION_READONLY
don't generate a set-method.- See Also:
- Constant Field Values
-
OPTION_WRITEONLY
public static final java.lang.String OPTION_WRITEONLY
don't generate a get-method.- See Also:
- Constant Field Values
-
OPTION_TRIM_READ
public static final java.lang.String OPTION_TRIM_READ
trim string on read.- See Also:
- Constant Field Values
-
OPTION_TRIM_WRITE
public static final java.lang.String OPTION_TRIM_WRITE
trim string on write.- See Also:
- Constant Field Values
-
OPTION_TRIM
public static final java.lang.String OPTION_TRIM
trim on read and write.- See Also:
- Constant Field Values
-
OPTION_MAPNULL
public static final java.lang.String OPTION_MAPNULL
map null to non-null value.- See Also:
- Constant Field Values
-
OPTION_SETGET
public static final java.lang.String OPTION_SETGET
always use set/get, don't use attributes directly in read/write.- See Also:
- Constant Field Values
-
OPTION_BIND
public static final java.lang.String OPTION_BIND
add binding information.- See Also:
- Constant Field Values
-
BIND_SIZE
public static final java.lang.String BIND_SIZE
set max columns and/or scale.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommonOptionsImpl
public CommonOptionsImpl(SourceInfo sourceInfo)
Creates options.- Parameters:
sourceInfo- the source info, null if none
-
-
Method Detail
-
getSourceInfo
public SourceInfo getSourceInfo()
Gets the source info.- Returns:
- the info, null if unknown
-
applyOption
public boolean applyOption(java.lang.String option, java.lang.Boolean ctrl) throws ModelExceptionApplies given option string.- Parameters:
option- the option stringctrl- 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
-
processOption
public boolean processOption(java.lang.String option) throws ModelExceptionProcesses 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 ofapplyOption(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(java.lang.String option, boolean on)Processes a bind option.- Parameters:
option- the bind optionon- true if append, else remove
-
getComment
public java.lang.String getComment()
Description copied from interface:CommonOptionsThe comment.- Specified by:
getCommentin interfaceCommonOptions- Returns:
- the comment
-
setComment
public void setComment(java.lang.String comment)
Sets the comment.- Parameters:
comment- the comment
-
getBindOptions
public java.lang.String getBindOptions()
Description copied from interface:CommonOptionsThe bind options.- Specified by:
getBindOptionsin interfaceCommonOptions- Returns:
- the bind options
-
setBindOptions
public void setBindOptions(java.lang.String bindOptions)
-
addBindOption
public void addBindOption(java.lang.String option)
Adds a bind option.- Parameters:
option- the option
-
removeBindOption
public void removeBindOption(java.lang.String option)
Removes a bind option.- Parameters:
option- the option
-
isNoDeclare
public boolean isNoDeclare()
Description copied from interface:CommonOptionstrue if [NODECLARE]-option set.- Specified by:
isNoDeclarein interfaceCommonOptions- Returns:
- the NoDeclare
-
isNoMethod
public boolean isNoMethod()
Description copied from interface:CommonOptionstrue if [NOMETHOD]-option set.- Specified by:
isNoMethodin interfaceCommonOptions- Returns:
- the NoMethod
-
isNoConstant
public boolean isNoConstant()
Description copied from interface:CommonOptionstrue if [NOCONSTANT]-option set.- Specified by:
isNoConstantin interfaceCommonOptions- Returns:
- the NoConstant
-
isDerived
public boolean isDerived()
Description copied from interface:CommonOptionstrue if [DERIVED]-option set.- Specified by:
isDerivedin interfaceCommonOptions- Returns:
- the Derived
-
isFromSuper
public boolean isFromSuper()
Description copied from interface:CommonOptionstrue if [SUPER]-option set.- Specified by:
isFromSuperin interfaceCommonOptions- Returns:
- the FromSuper
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:CommonOptionstrue if [READONLY]-option set.- Specified by:
isReadOnlyin interfaceCommonOptions- Returns:
- the ReadOnly
-
isWriteOnly
public boolean isWriteOnly()
Description copied from interface:CommonOptionstrue if [WRITEONLY]-option set.- Specified by:
isWriteOnlyin interfaceCommonOptions- Returns:
- the WriteOnly
-
getAccessScope
public AccessScope getAccessScope()
Description copied from interface:CommonOptionsThe access scope.- Specified by:
getAccessScopein interfaceCommonOptions- Returns:
- the AccessPackage
-
isTrimRead
public boolean isTrimRead()
Description copied from interface:CommonOptionstrue if [TRIMREAD]-option set.- Specified by:
isTrimReadin interfaceCommonOptions- Returns:
- the TrimRead
-
isTrimWrite
public boolean isTrimWrite()
Description copied from interface:CommonOptionstrue if [TRIMWRITE]-option set.- Specified by:
isTrimWritein interfaceCommonOptions- Returns:
- the TrimWrite
-
isMapNull
public boolean isMapNull()
Description copied from interface:CommonOptionstrue if [MAPNULL]-option set.- Specified by:
isMapNullin interfaceCommonOptions- Returns:
- the MapNull
-
isSetGet
public boolean isSetGet()
Description copied from interface:CommonOptionstrue if [SETGET]-option set.- Specified by:
isSetGetin interfaceCommonOptions- Returns:
- the SetGet
-
isBind
public boolean isBind()
Description copied from interface:CommonOptionstrue if [BIND]-option set.- Specified by:
isBindin interfaceCommonOptions- Returns:
- the Bind
-
setAccessScope
public void setAccessScope(AccessScope accessScope)
-
setBind
public void setBind(boolean bind)
-
setDerived
public void setDerived(boolean derived)
-
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)
-
setSetGet
public void setSetGet(boolean setGet)
-
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:CommonOptionsReturns whether autoselect should be turned on.- Specified by:
isAutoSelectin interfaceCommonOptions- Returns:
- true if autoselect
-
setAutoSelect
public void setAutoSelect(boolean autoSelect)
-
isLowerCase
public boolean isLowerCase()
Description copied from interface:CommonOptionsReturns whether lowercase conversion requested.- Specified by:
isLowerCasein interfaceCommonOptions- Returns:
- true if lowercase
-
setLowerCase
public void setLowerCase(boolean lowerCase)
-
isMaxCol
public boolean isMaxCol()
Description copied from interface:CommonOptionsReturns true whether the maxcol binding option should be applied.- Specified by:
isMaxColin interfaceCommonOptions- Returns:
- true if maxcol
-
setMaxCol
public void setMaxCol(boolean maxCol)
-
isUpperCase
public boolean isUpperCase()
Description copied from interface:CommonOptionsReturns whether uppercase conversion requested.- Specified by:
isUpperCasein interfaceCommonOptions- Returns:
- true if uppercase
-
setUpperCase
public void setUpperCase(boolean upperCase)
-
validate
public void validate() throws ModelExceptionDescription copied from interface:CommonOptionsValidates the options.- Specified by:
validatein interfaceCommonOptions- Throws:
ModelException- if validation failed
-
createModelException
public ModelException createModelException(java.lang.String message)
-
-