Class CommonOptionsImpl
java.lang.Object
org.tentackle.model.impl.CommonOptionsImpl
- All Implemented Interfaces:
Cloneable, Commented, CommonOptions
- Direct Known Subclasses:
AttributeOptionsImpl, EntityOptionsImpl
Implementation of common options.
- Author:
- harald
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAdds themaxcolsbinding option to the@Bindableannotation, limiting the bound input length to the column's size (and, where applicable, the numeric scale).static final StringAnnotates the generated accessors with@Bindable, making the property usable by the FX binding layer.static final StringMapsnullto a non-null sentinel (empty string or 0) in the database, so a nullable Java value can be stored in aNOT NULLcolumn.static final StringMarks the element as mute: mapped to a database column but deliberately invisible to the PDO.static final StringSuppresses the generated name constants for this element (theAN_/CN_attribute- and column-name constants and the size constant).static final StringSuppresses the backing-field declaration in the generated persistence implementation.static final StringSuppresses the getter and setter in the generated PDO interface and implementation.static final StringGenerates a getter only, no setter, so the application cannot modify the value.static final StringMarks the element as inherited from a non-modeled superclass.static final StringTruncates the string value to the column's size on both read and write (TRIMREAD+TRIMWRITE).static final StringTruncates the string value to the column's size when reading it from the database.static final StringTruncates the string value to the column's size when writing it to the database.static final StringGenerates a setter only, no getter, so the application cannot read the value back. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBindOption(String option) Adds a bind option.booleanapplyOption(String option, Boolean ctrl) Applies given option string.protected CommonOptionsImplclone()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.Gets the short comment.Gets the long comment.Gets the source info.Gets the list of custom stereotypes.org.tentackle.common.StripModeGets the strip mode.booleanReturns whether autoselect should be turned on.booleanGenerate bindable annotation.booleanDeclared in super class.booleanReturns whether lowercase conversion requested.booleanMap null values to constant in database.booleanisMaxCol()Returns true whether the maxcol binding option should be applied.booleanisMute()Element is mute.booleanNo constant strings.booleanNo declaration code.booleanNo getter and setter methods.booleanElement is read-only.booleanTrim on read from database.booleanTrim on write to database.booleanReturns whether uppercase conversion requested.booleanElement is write-only.voidprocessBindOption(String option, boolean on) Processes a bind option.booleanprocessOption(String option) Processes an option string.
If the option string starts with !voidremoveBindOption(String option) Removes a bind option.voidsetAccessScope(AccessScope accessScope) voidsetAutoSelect(boolean autoSelect) voidsetBindable(boolean bind) voidsetBindOptions(String bindOptions) voidsetComment(String comment) Sets the comment.voidsetFromSuper(boolean fromSuper) voidsetLongComment(String longComment) Sets the long comment.voidsetLowerCase(boolean lowerCase) voidsetMapNull(boolean mapNull) voidsetMaxCol(boolean maxCol) voidsetMute(boolean mute) voidsetNoConstant(boolean noConstant) voidsetNoDeclare(boolean noDeclare) voidsetNoMethod(boolean noMethod) voidsetReadOnly(boolean readOnly) voidsetStereotypes(List<String> stereotypes) voidsetStripMode(org.tentackle.common.StripMode stripMode) voidsetTrimRead(boolean trimRead) voidsetTrimWrite(boolean trimWrite) voidsetUpperCase(boolean upperCase) voidsetWriteOnly(boolean writeOnly) voidvalidate()Validates the options.
-
Field Details
-
OPTION_NODECLARE
Suppresses the backing-field declaration in the generated persistence implementation. The column is still mapped (read from and written to the database), but no field is emitted, because the value is held elsewhere (e.g. a derived or superclass field).- See Also:
-
OPTION_NOMETHOD
Suppresses the getter and setter in the generated PDO interface and implementation. The attribute is still declared and persisted, just not exposed through accessors.- See Also:
-
OPTION_NOCONSTANT
Suppresses the generated name constants for this element (theAN_/CN_attribute- and column-name constants and the size constant).- See Also:
-
OPTION_MUTE
Marks the element as mute: mapped to a database column but deliberately invisible to the PDO. No field, no accessors, no interface declaration, and excluded from snapshots and copies. Since persistence never touches it, a mute column must be nullable or carry a database default. Used for columns populated outside the object lifecycle (trigger, migration, hand-written code).- See Also:
-
OPTION_SUPER
Marks the element as inherited from a non-modeled superclass. The generator uses the attribute (in queries, the domain key, etc.) but emits no field, name constant or accessors for it, because they already exist upstream. (ImpliesNODECLAREandNOMETHOD.)- See Also:
-
OPTION_READONLY
Generates a getter only, no setter, so the application cannot modify the value. (The persistence layer still writes the column when the row is created.)- See Also:
-
OPTION_WRITEONLY
Generates a setter only, no getter, so the application cannot read the value back.- See Also:
-
OPTION_TRIM_READ
Truncates the string value to the column's size when reading it from the database.- See Also:
-
OPTION_TRIM_WRITE
Truncates the string value to the column's size when writing it to the database.- See Also:
-
OPTION_TRIM
Truncates the string value to the column's size on both read and write (TRIMREAD+TRIMWRITE).- See Also:
-
OPTION_MAPNULL
Mapsnullto a non-null sentinel (empty string or 0) in the database, so a nullable Java value can be stored in aNOT NULLcolumn. The conversion is applied in both directions by the generated JDBC read/write code.- See Also:
-
OPTION_BIND
Annotates the generated accessors with@Bindable, making the property usable by the FX binding layer. Setting any of the binding options below implies this option.- See Also:
-
BIND_SIZE
Adds themaxcolsbinding option to the@Bindableannotation, limiting the bound input length to the column's size (and, where applicable, the numeric 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
-
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:CommentedGets the short comment.- Specified by:
getCommentin interfaceCommented- Returns:
- the short comment, null if none
-
setComment
-
getLongComment
Description copied from interface:CommentedGets the long comment.- Specified by:
getLongCommentin interfaceCommented- Returns:
- the long comment, null if none
-
setLongComment
Sets the long comment.- Parameters:
longComment- the long comment
-
getStereotypes
Description copied from interface:CommonOptionsGets the list of custom stereotypes.- Specified by:
getStereotypesin interfaceCommonOptions- Returns:
- the stereotypes
-
setStereotypes
-
getBindOptions
Description copied from interface:CommonOptionsThe bind options.- Specified by:
getBindOptionsin interfaceCommonOptions- Returns:
- the bind options
-
setBindOptions
-
addBindOption
-
removeBindOption
-
isNoDeclare
public boolean isNoDeclare()Description copied from interface:CommonOptionsNo declaration code.- Specified by:
isNoDeclarein interfaceCommonOptions- Returns:
- true if don't generate declaration
-
isNoMethod
public boolean isNoMethod()Description copied from interface:CommonOptionsNo getter and setter methods.- Specified by:
isNoMethodin interfaceCommonOptions- Returns:
- true if no accessor methods must be generated
-
isNoConstant
public boolean isNoConstant()Description copied from interface:CommonOptionsNo constant strings.- Specified by:
isNoConstantin interfaceCommonOptions- Returns:
- true if no name constants must be generated
-
isMute
public boolean isMute()Description copied from interface:CommonOptionsElement is mute.- Specified by:
isMutein interfaceCommonOptions- Returns:
- true if not part of the pdo
-
isFromSuper
public boolean isFromSuper()Description copied from interface:CommonOptionsDeclared in super class.- Specified by:
isFromSuperin interfaceCommonOptions- Returns:
- true if element is derived from the super class
-
isReadOnly
public boolean isReadOnly()Description copied from interface:CommonOptionsElement is read-only.- Specified by:
isReadOnlyin interfaceCommonOptions- Returns:
- true if element cannot be modified
-
isWriteOnly
public boolean isWriteOnly()Description copied from interface:CommonOptionsElement is write-only.- Specified by:
isWriteOnlyin interfaceCommonOptions- Returns:
- true if element cannot be read by application
-
getAccessScope
Description copied from interface:CommonOptionsThe access scope.- Specified by:
getAccessScopein interfaceCommonOptions- Returns:
- the scope
-
isTrimRead
public boolean isTrimRead()Description copied from interface:CommonOptionsTrim on read from database.- Specified by:
isTrimReadin interfaceCommonOptions- Returns:
- true if string is trimmed when read
-
isTrimWrite
public boolean isTrimWrite()Description copied from interface:CommonOptionsTrim on write to database.- Specified by:
isTrimWritein interfaceCommonOptions- Returns:
- true if string is trimmed on write
-
isMapNull
public boolean isMapNull()Description copied from interface:CommonOptionsMap null values to constant in database.- Specified by:
isMapNullin interfaceCommonOptions- Returns:
- true if map null to non-null value
-
isBindable
public boolean isBindable()Description copied from interface:CommonOptionsGenerate bindable annotation.- Specified by:
isBindablein 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: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) -
getStripMode
public org.tentackle.common.StripMode getStripMode()Description copied from interface:CommonOptionsGets the strip mode.- Specified by:
getStripModein interfaceCommonOptions- Returns:
- the strip mode, null if default
-
setStripMode
public void setStripMode(org.tentackle.common.StripMode stripMode) -
validate
Description copied from interface:CommonOptionsValidates the options.- Specified by:
validatein interfaceCommonOptions- Throws:
ModelException- if validation failed
-
createModelException
-