java.lang.Object
org.tentackle.model.impl.CommonOptionsImpl
- All Implemented Interfaces:
Cloneable
,CommonOptions
- Direct Known Subclasses:
AttributeOptionsImpl
,EntityOptionsImpl
Implementation of common options.
- Author:
- harald
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
set max columns and/or scale.static final String
add binding information.static final String
map null to non-null value.static final String
element is mute (not part of PDO).static final String
don't generate static constants.static final String
don't generate declaration.static final String
don't generate accessor methods.static final String
don't generate a set-method.static final String
element is derived from superclass.static final String
trim on read and write.static final String
trim string on read.static final String
trim string on write.static final String
don't generate a get-method. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBindOption
(String option) Adds a bind option.boolean
applyOption
(String option, Boolean ctrl) Applies given option string.protected CommonOptionsImpl
clone()
Clones the options.
Protected since subclasses' clone() methods are protected to enforce invocation via special clone methods with additional arguments.createModelException
(String message) The access scope.The bind options.The comment.Gets the source info.Gets the list of custom stereotypes.boolean
Returns whether autoselect should be turned on.boolean
Generate bindable annotation.boolean
Declared in super class.boolean
Returns whether lowercase conversion requested.boolean
Map null values to constant in database.boolean
isMaxCol()
Returns true whether the maxcol binding option should be applied.boolean
isMute()
Element is mute.boolean
No constant strings.boolean
No declaration code.boolean
No getter and setter methods.boolean
Element is read-only.boolean
Trim on read from database.boolean
Trim on write to database.boolean
Returns whether uppercase conversion requested.boolean
Element is write-only.void
processBindOption
(String option, boolean on) Processes a bind option.boolean
processOption
(String option) Processes an option string.
If the option string starts with !void
removeBindOption
(String option) Removes a bind option.void
setAccessScope
(AccessScope accessScope) void
setAutoSelect
(boolean autoSelect) void
setBindable
(boolean bind) void
setBindOptions
(String bindOptions) void
setComment
(String comment) Sets the comment.void
setFromSuper
(boolean fromSuper) void
setLowerCase
(boolean lowerCase) void
setMapNull
(boolean mapNull) void
setMaxCol
(boolean maxCol) void
setMute
(boolean mute) void
setNoConstant
(boolean noConstant) void
setNoDeclare
(boolean noDeclare) void
setNoMethod
(boolean noMethod) void
setReadOnly
(boolean readOnly) void
setStereotypes
(List<String> stereotypes) void
setTrimRead
(boolean trimRead) void
setTrimWrite
(boolean trimWrite) void
setUpperCase
(boolean upperCase) void
setWriteOnly
(boolean writeOnly) void
validate()
Validates the options.
-
Field Details
-
OPTION_NODECLARE
don't generate declaration.- See Also:
-
OPTION_NOMETHOD
don't generate accessor methods.- See Also:
-
OPTION_NOCONSTANT
don't generate static constants.- See Also:
-
OPTION_MUTE
element is mute (not part of PDO).- See Also:
-
OPTION_SUPER
element is derived from superclass.- See Also:
-
OPTION_READONLY
don't generate a set-method.- See Also:
-
OPTION_WRITEONLY
don't generate a get-method.- See Also:
-
OPTION_TRIM_READ
trim string on read.- See Also:
-
OPTION_TRIM_WRITE
trim string on write.- See Also:
-
OPTION_TRIM
trim on read and write.- See Also:
-
OPTION_MAPNULL
map null to non-null value.- See Also:
-
OPTION_BIND
add binding information.- See Also:
-
BIND_SIZE
set max columns and/or scale.- See Also:
-
-
Constructor Details
-
CommonOptionsImpl
Creates options.- Parameters:
sourceInfo
- the source info, null if none
-
-
Method Details
-
clone
Clones the options.
Protected since subclasses' clone() methods are protected to enforce invocation via special clone methods with additional arguments. -
getSourceInfo
Gets the source info.- Returns:
- the info, null if unknown
-
applyOption
Applies given option string.- Parameters:
option
- the option stringctrl
- 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
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 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
Processes a bind option.- Parameters:
option
- the bind optionon
- true to add, else remove the option
-
getComment
Description copied from interface:CommonOptions
The comment.- Specified by:
getComment
in interfaceCommonOptions
- Returns:
- the comment
-
setComment
Sets the comment.- Parameters:
comment
- the comment
-
getStereotypes
Description copied from interface:CommonOptions
Gets the list of custom stereotypes.- Specified by:
getStereotypes
in interfaceCommonOptions
- Returns:
- the stereotypes
-
setStereotypes
-
getBindOptions
Description copied from interface:CommonOptions
The bind options.- Specified by:
getBindOptions
in interfaceCommonOptions
- Returns:
- the bind options
-
setBindOptions
-
addBindOption
Adds a bind option.- Parameters:
option
- the option
-
removeBindOption
Removes a bind option.- Parameters:
option
- the option
-
isNoDeclare
public boolean isNoDeclare()Description copied from interface:CommonOptions
No declaration code.- Specified by:
isNoDeclare
in interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- Returns:
- true if element cannot be modified
-
isWriteOnly
public boolean isWriteOnly()Description copied from interface:CommonOptions
Element is write-only.- Specified by:
isWriteOnly
in interfaceCommonOptions
- Returns:
- true if element cannot be read by application
-
getAccessScope
Description copied from interface:CommonOptions
The access scope.- Specified by:
getAccessScope
in interfaceCommonOptions
- Returns:
- the scope
-
isTrimRead
public boolean isTrimRead()Description copied from interface:CommonOptions
Trim on read from database.- Specified by:
isTrimRead
in interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- Returns:
- true if bindable element
-
setAccessScope
-
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 interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- 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 interfaceCommonOptions
- Returns:
- true if uppercase
-
setUpperCase
public void setUpperCase(boolean upperCase) -
validate
Description copied from interface:CommonOptions
Validates the options.- Specified by:
validate
in interfaceCommonOptions
- Throws:
ModelException
- if validation failed
-
createModelException
-