java.lang.Object
org.tentackle.model.impl.CommonOptionsImpl
org.tentackle.model.impl.AttributeOptionsImpl
- All Implemented Interfaces:
AttributeOptions,CommonOptions
- Author:
- harald
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthis is the object id holding the context.static final Stringgenerate SQL DEFAULT.static final Stringthis is a unique domain key (or part of it).static final Stringhidden attribute (no interface definition).static final Stringinitial value.static final Stringadd toString value to the partOfNormText.static final Stringshallow attribute (ignored in snapshots and copies).static final Stringtimestamp, date or time with database timezone.Fields inherited from class org.tentackle.model.impl.CommonOptionsImpl
BIND_SIZE, OPTION_BIND, OPTION_MAPNULL, OPTION_MUTE, OPTION_NOCONSTANT, OPTION_NODECLARE, OPTION_NOMETHOD, OPTION_READONLY, OPTION_SUPER, OPTION_TRIM, OPTION_TRIM_READ, OPTION_TRIM_WRITE, OPTION_WRITEONLY -
Constructor Summary
ConstructorsConstructorDescriptionAttributeOptionsImpl(Attribute attribute, SourceInfo sourceInfo) Creates attribute options. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyEntityOptions(EntityOptions options, DataType<?> dataType) Sets the default from entity options.booleanapplyOption(String option, Boolean ctrl) Applies given option string.createModelException(String message) Gets the list of annotations.
Annotations start with an @.Gets the attribute this option-set belongs to.Gets the default value if [DEFAULT value] given.
The returned type corresponds to the DataType of the Attribute.Gets the initial value if [INIT value] given.booleanReturns whether this is the object id holding the context.booleanReturns whether only digits are allowed as input.
Applies only to strings.booleanReturns whether this is a unique domain key (or part of it).booleanisHidden()Returns whether the attribute is not declared in the interface.booleanReturns whether the attribute becomes part of the normtext.booleanReturns whether the attribute should be skipped in snapshot and copy operations.booleanReturns whether this is an unsigned numeric field.booleanisUTC()Returns whether this is a UTC timestamp.booleanReturns 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:voidsetAnnotations(List<String> annotations) voidsetContextId(boolean contextId) voidsetDefaultValue(Object defaultValue) voidsetDigitsOnly(boolean digitsOnly) voidsetDomainKey(boolean domainKey) voidsetHidden(boolean hidden) voidsetInitialValue(String initialValue) voidsetPartOfNormText(boolean partOfNormText) voidsetShallow(boolean shallow) voidsetUnsigned(boolean unsigned) voidsetUTC(boolean utc) voidsetWithTimezone(boolean withTimezone) Methods inherited from class org.tentackle.model.impl.CommonOptionsImpl
addBindOption, getAccessScope, getBindOptions, getComment, getSourceInfo, getStereotypes, isAutoSelect, isBindable, isFromSuper, isLowerCase, isMapNull, isMaxCol, isMute, isNoConstant, isNoDeclare, isNoMethod, isReadOnly, isTrimRead, isTrimWrite, isUpperCase, isWriteOnly, processBindOption, processOption, removeBindOption, setAccessScope, setAutoSelect, setBindable, setBindOptions, setComment, setFromSuper, setLowerCase, setMapNull, setMaxCol, setMute, setNoConstant, setNoDeclare, setNoMethod, setReadOnly, setStereotypes, setTrimRead, setTrimWrite, setUpperCase, setWriteOnly, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tentackle.model.CommonOptions
getAccessScope, getBindOptions, getComment, getStereotypes, isAutoSelect, isBindable, isFromSuper, isLowerCase, isMapNull, isMaxCol, isMute, isNoConstant, isNoDeclare, isNoMethod, isReadOnly, isTrimRead, isTrimWrite, isUpperCase, isWriteOnly, validate
-
Field Details
-
OPTION_DEFAULT
generate SQL DEFAULT.- See Also:
-
OPTION_INIT
initial value.- See Also:
-
OPTION_CONTEXT
this is the object id holding the context.- See Also:
-
OPTION_DOMAINKEY
this is a unique domain key (or part of it).- See Also:
-
OPTION_TZ
timestamp, date or time with database timezone.- See Also:
-
OPTION_HIDDEN
hidden attribute (no interface definition).- See Also:
-
OPTION_SHALLOW
shallow attribute (ignored in snapshots and copies).- See Also:
-
OPTION_NORMTEXT
add toString value to the partOfNormText.- See Also:
-
-
Constructor Details
-
AttributeOptionsImpl
Creates attribute options.- Parameters:
attribute- the attributesourceInfo- the source info, null if none
-
-
Method Details
-
getAttribute
Description copied from interface:AttributeOptionsGets the attribute this option-set belongs to.- Specified by:
getAttributein interfaceAttributeOptions- Returns:
- the entity
-
applyEntityOptions
Sets the default from entity options.- Parameters:
options- the entity optionsdataType- the datatype of the attribute
-
applyOption
Description copied from class:CommonOptionsImplApplies given option string.- Overrides:
applyOptionin classCommonOptionsImpl- 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
-
getAnnotations
Description copied from interface:AttributeOptionsGets 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.
@=~MyAnnowill be applied to the implementation of the setter only.- Specified by:
getAnnotationsin interfaceAttributeOptions- Returns:
- the annotations
-
getDefaultValue
Description copied from interface:AttributeOptionsGets the default value if [DEFAULT value] given.
The returned type corresponds to the DataType of the Attribute.- Specified by:
getDefaultValuein interfaceAttributeOptions- Returns:
- the defaultValue
-
getInitialValue
Description copied from interface:AttributeOptionsGets the initial value if [INIT value] given.- Specified by:
getInitialValuein interfaceAttributeOptions- Returns:
- the string to initialize the declaration with
-
setAnnotations
-
setDefaultValue
-
setInitialValue
-
isContextId
public boolean isContextId()Description copied from interface:AttributeOptionsReturns whether this is the object id holding the context.- Specified by:
isContextIdin interfaceAttributeOptions- Returns:
- true if context id
-
setContextId
public void setContextId(boolean contextId) -
isDomainKey
public boolean isDomainKey()Description copied from interface:AttributeOptionsReturns whether this is a unique domain key (or part of it).- Specified by:
isDomainKeyin interfaceAttributeOptions- Returns:
- true if domain key
-
setDomainKey
public void setDomainKey(boolean domainKey) -
isUTC
public boolean isUTC()Description copied from interface:AttributeOptionsReturns whether this is a UTC timestamp.- Specified by:
isUTCin interfaceAttributeOptions- Returns:
- true if UTC
-
setUTC
public void setUTC(boolean utc) -
isWithTimezone
public boolean isWithTimezone()Description copied from interface:AttributeOptionsReturns 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:
isWithTimezonein interfaceAttributeOptions- Returns:
- true if with timezone
-
setWithTimezone
public void setWithTimezone(boolean withTimezone) -
isUnsigned
public boolean isUnsigned()Description copied from interface:AttributeOptionsReturns whether this is an unsigned numeric field.- Specified by:
isUnsignedin interfaceAttributeOptions- Returns:
- true if unsigned
-
setUnsigned
public void setUnsigned(boolean unsigned) -
isDigitsOnly
public boolean isDigitsOnly()Description copied from interface:AttributeOptionsReturns whether only digits are allowed as input.
Applies only to strings. Number types provide their own rules.- Specified by:
isDigitsOnlyin interfaceAttributeOptions- Returns:
- true if allow only digits
-
setDigitsOnly
public void setDigitsOnly(boolean digitsOnly) -
isHidden
public boolean isHidden()Description copied from interface:AttributeOptionsReturns whether the attribute is not declared in the interface.- Specified by:
isHiddenin interfaceAttributeOptions- Returns:
- true if implemented only, no public interface definition
-
setHidden
public void setHidden(boolean hidden) -
isShallow
public boolean isShallow()Description copied from interface:AttributeOptionsReturns whether the attribute should be skipped in snapshot and copy operations.- Specified by:
isShallowin interfaceAttributeOptions- Returns:
- true if skip this attribute, false to include (default)
-
setShallow
public void setShallow(boolean shallow) -
isPartOfNormText
public boolean isPartOfNormText()Description copied from interface:AttributeOptionsReturns whether the attribute becomes part of the normtext.- Specified by:
isPartOfNormTextin interfaceAttributeOptions- Returns:
- true if add to normtext
-
setPartOfNormText
public void setPartOfNormText(boolean partOfNormText) -
createModelException
- Overrides:
createModelExceptionin classCommonOptionsImpl
-