Package simpleorm.dataset
Class SFieldScalar
- java.lang.Object
-
- simpleorm.dataset.SFieldMeta
-
- simpleorm.dataset.SFieldScalar
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
SFieldBigDecimal
,SFieldBlob
,SFieldBoolean
,SFieldBytes
,SFieldDate
,SFieldDouble
,SFieldEnum
,SFieldInteger
,SFieldLong
,SFieldObject
,SFieldString
,SFieldTime
,SFieldTimestamp
public abstract class SFieldScalar extends SFieldMeta
Scalar fields such as String, Int, but not References to other tables. Only scalars are actually stored in tables. It is scalars that are marked as primary keys etc.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
sqlDataTypeOverride
java.lang.Object
theGenerator
-
Fields inherited from class simpleorm.dataset.SFieldMeta
quoteName
-
-
Constructor Summary
Constructors Constructor Description SFieldScalar(SRecordMeta sRecord, java.lang.String fieldName, SFieldFlags... pvals)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.String
defaultSqlDataType()
The default data type if not overriden by overrideSqlDataType.java.lang.String
getColumnName()
The column name, which for now is the same as the field name but that may change.SGeneratorMode
getGeneratorMode()
java.lang.Object[]
getGeneratorParameter()
int
getMaxSize()
protected java.util.List<SFieldReference>
getReferences()
java.lang.Object
getTheGenerator()
boolean
isForeignKey()
Is this field part of at least one forign key ?boolean
isGenerated()
boolean
isMandatory()
boolean
isNotOptimisticLocked()
boolean
isPrimary()
abstract int
javaSqlType()
<T extends SFieldScalar>
ToverrideSqlDataType(java.lang.String dataType)
If set, this overrides the entire column data type string generated in the CREATE TABLE string<T extends SFieldScalar>
TsetGeneratorMode(SGeneratorMode gen, java.lang.Object... gParams)
Sets the generator associated to this field.protected void
setMaxSize(int maxSize)
void
setTheGenerator(java.lang.Object theGenerator)
java.lang.String
toLongerString()
Lists all the details of the field.-
Methods inherited from class simpleorm.dataset.SFieldMeta
addFlag, addValidator, convertToDataSetFieldType, doValidate, equals, getFieldName, getFlags, getRecordMeta, getUserProperties, getUserProperty, getValidators, hashCode, isDescriptive, isUnqueried, nextGeneratedValue, putUserProperty, queryFieldValue, readResolve, setQuoted, toString, writeFieldValue, writeFieldValue
-
-
-
-
Constructor Detail
-
SFieldScalar
public SFieldScalar(SRecordMeta sRecord, java.lang.String fieldName, SFieldFlags... pvals)
-
-
Method Detail
-
overrideSqlDataType
public <T extends SFieldScalar> T overrideSqlDataType(java.lang.String dataType)
If set, this overrides the entire column data type string generated in the CREATE TABLE string
-
defaultSqlDataType
public abstract java.lang.String defaultSqlDataType()
The default data type if not overriden by overrideSqlDataType. This is only called when the data type is actually needed by CREATE TABLE, ie if no sqlDataTypeOverride is specified.
-
javaSqlType
public abstract int javaSqlType()
- Returns:
- int constant from java.sql.Types, used for setting sql datatype with null values
-
isMandatory
public boolean isMandatory()
- Overrides:
isMandatory
in classSFieldMeta
-
isGenerated
public boolean isGenerated()
-
isPrimary
public boolean isPrimary()
-
isNotOptimisticLocked
public boolean isNotOptimisticLocked()
-
getColumnName
public java.lang.String getColumnName()
The column name, which for now is the same as the field name but that may change.
-
getReferences
protected java.util.List<SFieldReference> getReferences()
-
toLongerString
public java.lang.String toLongerString()
Description copied from class:SFieldMeta
Lists all the details of the field.- Specified by:
toLongerString
in classSFieldMeta
-
isForeignKey
public boolean isForeignKey()
Is this field part of at least one forign key ?- Overrides:
isForeignKey
in classSFieldMeta
-
setGeneratorMode
public <T extends SFieldScalar> T setGeneratorMode(SGeneratorMode gen, java.lang.Object... gParams)
Sets the generator associated to this field. This will make the field generated, reference the generator for future use and **remove any NotNullValidaotr*** (so if you want to add one, do it after you call setGenerator)
-
getGeneratorMode
public SGeneratorMode getGeneratorMode()
-
getGeneratorParameter
public java.lang.Object[] getGeneratorParameter()
-
getTheGenerator
public java.lang.Object getTheGenerator()
-
setTheGenerator
public void setTheGenerator(java.lang.Object theGenerator)
-
setMaxSize
protected void setMaxSize(int maxSize)
-
getMaxSize
public int getMaxSize()
-
-