public abstract class SFieldMeta
extends java.lang.Object
implements java.io.Serializable
SRecordMeta
.
Subclasses are used for specific data types, with SFieldObject
being
the most generic. Like JDBC, type conversions are made automatically.
Internally, the types are stored accurately. Ie. the
SRecordInstance.getObject
objects are the exact types as
declared (String, Integer, Employee etc.) However, generous automatic
conversions are performed both when accessing these from the application and
when getting and setting columns in the database.
Modifier and Type | Field and Description |
---|---|
boolean |
quoteName |
Modifier and Type | Method and Description |
---|---|
<T extends SFieldMeta> |
addFlag(SFieldFlags flag)
Add a FieldFlag as an afterthought.
|
<T extends SFieldMeta> |
addValidator(SValidatorI val)
Add a custom FieldValidator.
|
protected abstract java.lang.Object |
convertToDataSetFieldType(java.lang.Object raw)
Converts the parameter from the raw type parameter to the correct internal Object
type that is stored in the data set.
|
protected void |
doValidate(SRecordInstance instance)
Called when individual field changed, or when record updated.
|
boolean |
equals(java.lang.Object that) |
java.lang.String |
getFieldName() |
protected java.util.EnumSet<SFieldFlags> |
getFlags() |
SRecordMeta |
getRecordMeta() |
java.util.Map |
getUserProperties() |
<T> T |
getUserProperty(java.lang.Object key) |
java.util.List<SValidatorI> |
getValidators()
Get the list of validators that are bound to this field.
|
int |
hashCode() |
boolean |
isDescriptive() |
protected boolean |
isForeignKey() |
boolean |
isMandatory() |
boolean |
isUnqueried() |
long |
nextGeneratedValue(long minimum)
This is used to fudge generation of key values for in databases that do not properly
suport them.
|
<T extends SFieldMeta> |
putUserProperty(java.lang.Object key,
java.lang.Object value) |
abstract java.lang.Object |
queryFieldValue(java.sql.ResultSet rs,
int sqlIndex)
Issues a JDBC get*() on the result set for the field and converts the
database type to the appropriate internal type, eg, Double for a double
field.
|
protected java.lang.Object |
readResolve()
Reflected into during de-serialization to return any pre-existing SFieldMeta object
|
<T extends SFieldMeta> |
setQuoted(boolean quoted)
Causes the generated sql to quote ("") the column name.
|
abstract java.lang.String |
toLongerString()
Lists all the details of the field.
|
java.lang.String |
toString()
Lists the record and column name only.
|
java.lang.Object |
writeFieldValue(java.lang.Object value)
Converts a single value from internal representation to database
representation.
|
void |
writeFieldValue(java.sql.PreparedStatement ps,
int sqlIndex,
java.lang.Object value)
Places a value in a prepared statement in the database representation
used during SRecordInstance.flush.
|
protected java.util.EnumSet<SFieldFlags> getFlags()
public boolean isUnqueried()
public boolean isDescriptive()
public <T extends SFieldMeta> T setQuoted(boolean quoted)
public abstract java.lang.Object queryFieldValue(java.sql.ResultSet rs, int sqlIndex) throws java.lang.Exception
java.lang.Exception
protected abstract java.lang.Object convertToDataSetFieldType(java.lang.Object raw) throws java.lang.Exception
SRecordInstance.setObject
etc., Not getObject.java.lang.Exception
public void writeFieldValue(java.sql.PreparedStatement ps, int sqlIndex, java.lang.Object value)
(This does NOT need to handle NULL values (those are handled seperately by SRecordInstance))
public java.lang.Object writeFieldValue(java.lang.Object value)
Overidden by SFieldBoolean. (not by SFieldString).
NOTE: This does NOT need to handle NULL values (those are handled seperately by SRecordInstance)
public java.lang.String toString()
toString
in class java.lang.Object
public abstract java.lang.String toLongerString()
protected boolean isForeignKey()
public long nextGeneratedValue(long minimum)
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
public java.lang.String getFieldName()
public boolean equals(java.lang.Object that)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public SRecordMeta getRecordMeta()
public boolean isMandatory()
public <T extends SFieldMeta> T addValidator(SValidatorI val)
public <T extends SFieldMeta> T addFlag(SFieldFlags flag)
public java.util.List<SValidatorI> getValidators()
protected void doValidate(SRecordInstance instance)
public <T extends SFieldMeta> T putUserProperty(java.lang.Object key, java.lang.Object value)
public <T> T getUserProperty(java.lang.Object key)
public java.util.Map getUserProperties()