- java.lang.Object
-
- org.tentackle.model.impl.CommonOptionsImpl
-
- org.tentackle.model.impl.AttributeOptionsImpl
-
- All Implemented Interfaces:
AttributeOptions,CommonOptions
public class AttributeOptionsImpl extends CommonOptionsImpl implements AttributeOptions
- Author:
- harald
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringOPTION_CONTEXTthis is the object id holding the context.static java.lang.StringOPTION_DEFAULTgenerate SQL DEFAULT.static java.lang.StringOPTION_DOMAINKEYthis is a unique domain key (or part of it).static java.lang.StringOPTION_HIDDENhidden attribute (no interface definition).static java.lang.StringOPTION_INITinitial value.static java.lang.StringOPTION_SHALLOWshallow attribute (ignored in snapshots and copies).static java.lang.StringOPTION_TZtimestamp, date or time with database timezone.-
Fields inherited from class org.tentackle.model.impl.CommonOptionsImpl
BIND_SIZE, OPTION_BIND, OPTION_DERIVED, OPTION_MAPNULL, OPTION_NOCONSTANT, OPTION_NODECLARE, OPTION_NOMETHOD, OPTION_READONLY, OPTION_SETGET, OPTION_SUPER, OPTION_TRIM, OPTION_TRIM_READ, OPTION_TRIM_WRITE, OPTION_WRITEONLY
-
-
Constructor Summary
Constructors Constructor Description AttributeOptionsImpl(Attribute attribute, SourceInfo sourceInfo)Creates attribute options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyEntityOptions(EntityOptions options, DataType dataType)Sets the default from entity options.booleanapplyOption(java.lang.String option, java.lang.Boolean ctrl)Applies given option string.ModelExceptioncreateModelException(java.lang.String message)java.util.List<java.lang.String>getAnnotations()list of annotations.AttributeImplgetAttribute()Gets the attribute this option-set belongs to.java.lang.ObjectgetDefaultValue()Gets the default value if [DEFAULT value] given.
The returned type corresponds to the DataType of the Attribute.java.lang.StringgetInitialValue()Gets the initial value if [INIT value] given.booleanisContextId()Returns whether this is the object id holding the context.booleanisDomainKey()Returns whether this is a unique domain key (or part of it).booleanisHidden()Returns whether the attribute is not declared in the interface.booleanisShallow()Returns whether the attribute should be skipped in snapshot and copy operations.booleanisUnsigned()Returns whether this is an unsigned numeric field.booleanisUTC()Returns whether this is a UTC timestamp.booleanisWithTimezone()Returns 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(java.util.List<java.lang.String> annotations)voidsetContextId(boolean contextId)voidsetDefaultValue(java.lang.Object defaultValue)voidsetDomainKey(boolean domainKey)voidsetHidden(boolean hidden)voidsetInitialValue(java.lang.String initialValue)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, isAutoSelect, isBind, isDerived, isFromSuper, isLowerCase, isMapNull, isMaxCol, isNoConstant, isNoDeclare, isNoMethod, isReadOnly, isSetGet, isTrimRead, isTrimWrite, isUpperCase, isWriteOnly, processBindOption, processOption, removeBindOption, setAccessScope, setAutoSelect, setBind, setBindOptions, setComment, setDerived, setFromSuper, setLowerCase, setMapNull, setMaxCol, setNoConstant, setNoDeclare, setNoMethod, setReadOnly, setSetGet, setTrimRead, setTrimWrite, setUpperCase, setWriteOnly, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tentackle.model.CommonOptions
getAccessScope, getBindOptions, getComment, isAutoSelect, isBind, isDerived, isFromSuper, isLowerCase, isMapNull, isMaxCol, isNoConstant, isNoDeclare, isNoMethod, isReadOnly, isSetGet, isTrimRead, isTrimWrite, isUpperCase, isWriteOnly, validate
-
-
-
-
Field Detail
-
OPTION_DEFAULT
public static final java.lang.String OPTION_DEFAULT
generate SQL DEFAULT.- See Also:
- Constant Field Values
-
OPTION_INIT
public static final java.lang.String OPTION_INIT
initial value.- See Also:
- Constant Field Values
-
OPTION_CONTEXT
public static final java.lang.String OPTION_CONTEXT
this is the object id holding the context.- See Also:
- Constant Field Values
-
OPTION_DOMAINKEY
public static final java.lang.String OPTION_DOMAINKEY
this is a unique domain key (or part of it).- See Also:
- Constant Field Values
-
OPTION_TZ
public static final java.lang.String OPTION_TZ
timestamp, date or time with database timezone.- See Also:
- Constant Field Values
-
OPTION_HIDDEN
public static final java.lang.String OPTION_HIDDEN
hidden attribute (no interface definition).- See Also:
- Constant Field Values
-
OPTION_SHALLOW
public static final java.lang.String OPTION_SHALLOW
shallow attribute (ignored in snapshots and copies).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AttributeOptionsImpl
public AttributeOptionsImpl(Attribute attribute, SourceInfo sourceInfo)
Creates attribute options.- Parameters:
attribute- the attributesourceInfo- the source info, null if none
-
-
Method Detail
-
getAttribute
public AttributeImpl getAttribute()
Description copied from interface:AttributeOptionsGets the attribute this option-set belongs to.- Specified by:
getAttributein interfaceAttributeOptions- Returns:
- the entity
-
applyEntityOptions
public void applyEntityOptions(EntityOptions options, DataType dataType)
Sets the default from entity options.- Parameters:
options- the entity optionsdataType- the datatype of the attribute
-
applyOption
public boolean applyOption(java.lang.String option, java.lang.Boolean ctrl) throws ModelExceptionDescription 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
public java.util.List<java.lang.String> getAnnotations()
Description copied from interface:AttributeOptionslist of annotations.- Specified by:
getAnnotationsin interfaceAttributeOptions- Returns:
- the annotations
-
getDefaultValue
public java.lang.Object 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
public java.lang.String 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
public void setAnnotations(java.util.List<java.lang.String> annotations)
-
setDefaultValue
public void setDefaultValue(java.lang.Object defaultValue)
-
setInitialValue
public void setInitialValue(java.lang.String initialValue)
-
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)
-
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)
-
createModelException
public ModelException createModelException(java.lang.String message)
- Overrides:
createModelExceptionin classCommonOptionsImpl
-
-