|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.melati.poem.BasePoemType
public abstract class BasePoemType
Base class of all fundamental types.
| Field Summary | |
|---|---|
protected boolean |
nullable
|
| Method Summary | |
|---|---|
protected abstract void |
_assertValidCooked(java.lang.Object cooked)
|
protected abstract void |
_assertValidRaw(java.lang.Object raw)
|
protected abstract boolean |
_canRepresent(SQLPoemType other)
|
protected abstract java.lang.Object |
_cookedOfRaw(java.lang.Object raw)
Converts a non-null low-level representation of a database column value to the appropriate object. |
protected abstract java.lang.Object |
_getRaw(java.sql.ResultSet rs,
int col)
|
protected java.util.Enumeration |
_possibleRaws()
|
protected abstract java.lang.String |
_quotedRaw(java.lang.Object raw)
|
protected abstract java.lang.Object |
_rawOfCooked(java.lang.Object raw)
|
protected abstract java.lang.Object |
_rawOfString(java.lang.String string)
Converts a non-null string to an appropriate value for insertion into the underlying DBMS. |
protected abstract void |
_saveColumnInfo(ColumnInfo info)
|
protected abstract void |
_setRaw(java.sql.PreparedStatement ps,
int col,
java.lang.Object raw)
|
protected abstract java.lang.String |
_sqlDefinition(Dbms dbms)
|
protected abstract java.lang.String |
_stringOfCooked(java.lang.Object cooked,
PoemLocale locale,
int style)
|
protected abstract java.lang.String |
_stringOfRaw(java.lang.Object raw)
|
protected abstract java.lang.String |
_toString()
|
void |
assertValidCooked(java.lang.Object cooked)
Check if an Object is valid, throw appropriate Exception if not. |
void |
assertValidRaw(java.lang.Object raw)
Check if value is of the right type and an allowed value, throw appropriate Exception if not. |
PoemType |
canRepresent(PoemType other)
Return a PoemType which can can represent another, or null. |
protected java.lang.Object |
clone()
|
java.lang.Object |
cookedOfRaw(java.lang.Object raw)
Converts a possibly null low-level representation of a database column value to its canonical form. |
protected java.lang.Comparable |
getLimitRaw()
|
protected java.lang.Comparable |
getLowRaw()
|
boolean |
getNullable()
Whether the type is nullable. |
java.lang.Object |
getRaw(java.sql.ResultSet rs,
int col)
Return an object as delivered by the database. |
java.util.Enumeration |
possibleRaws()
Get the possible values for this field, null for rangeable types with no range set. |
java.lang.String |
quotedRaw(java.lang.Object raw)
Quoting a raw value, if appropriate, for the Dbms. |
java.lang.Object |
rawOfCooked(java.lang.Object cooked)
Return the Object value, a no-op for all but ReferencePoemTypes, for which it returns the troid as an Integer. |
java.lang.Object |
rawOfString(java.lang.String string)
Converts a possibly null String to a low level
representation of a valid database column value. |
void |
saveColumnInfo(ColumnInfo info)
Set the type of the ColumnInfo. |
void |
setRaw(java.sql.PreparedStatement ps,
int col,
java.lang.Object raw)
Set a column of a PreparedStatement to the passed in value. |
void |
setRawRange(java.lang.Comparable low,
java.lang.Comparable limit)
Set the limits, if applicable. |
java.lang.String |
sqlDefinition(Dbms dbms)
See http://dev.mysql.com/doc/refman/5.0/en/timestamp.html The MySQL default for nullability of timestamps is not null, so need to make all fields explicitly nullable. |
int |
sqlTypeCode()
|
java.lang.String |
sqlTypeDefinition(Dbms dbms)
SQL type definition without nullability. |
java.lang.String |
stringOfCooked(java.lang.Object cooked,
PoemLocale locale,
int style)
A localised String representation of the oject. |
java.lang.String |
stringOfRaw(java.lang.Object raw)
This doesn't do an explicit assertValidRaw. |
java.lang.String |
toString()
|
PoemType |
withNullable(boolean nullableP)
Get a new type with a nullablity, presumably different. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.melati.poem.SQLType |
|---|
sqlDefaultValue |
| Methods inherited from interface org.melati.poem.PoemType |
|---|
toDsdType |
| Field Detail |
|---|
protected boolean nullable
| Method Detail |
|---|
public void setRawRange(java.lang.Comparable low,
java.lang.Comparable limit)
low - included lower limitlimit - excluded upper limitprotected java.lang.Comparable getLowRaw()
protected java.lang.Comparable getLimitRaw()
protected abstract void _assertValidRaw(java.lang.Object raw)
throws ValidationPoemException
ValidationPoemException
public final void assertValidRaw(java.lang.Object raw)
throws ValidationPoemException
assertValidRaw in interface PoemTyperaw - the raw value to check
ValidationPoemException - if the raw has an illegal valuePoemType.assertValidRaw(java.lang.Object)
protected abstract java.lang.Object _getRaw(java.sql.ResultSet rs,
int col)
throws java.sql.SQLException
java.sql.SQLException
public final java.lang.Object getRaw(java.sql.ResultSet rs,
int col)
throws ValidationPoemException
getRaw in interface SQLTypers - the Resultset containing the valuecol - the column withing the ResultSet to read
ValidationPoemExceptionSQLType.getRaw(java.sql.ResultSet, int)
protected abstract void _setRaw(java.sql.PreparedStatement ps,
int col,
java.lang.Object raw)
throws java.sql.SQLException
java.sql.SQLException
public final void setRaw(java.sql.PreparedStatement ps,
int col,
java.lang.Object raw)
setRaw in interface SQLTypeps - the Prepared Statement to modifycol - the column within the PreparedStatementraw - the value to setSQLType.setRaw(java.sql.PreparedStatement, int, java.lang.Object)protected java.util.Enumeration _possibleRaws()
public java.util.Enumeration possibleRaws()
possibleRaws in interface PoemTypePoemType.possibleRaws()protected abstract java.lang.String _stringOfRaw(java.lang.Object raw)
public final java.lang.String stringOfRaw(java.lang.Object raw)
throws ValidationPoemException
stringOfRaw in interface PoemTyperaw - the value
ValidationPoemException - if the raw has an illegal valuePoemType.stringOfRaw(java.lang.Object)
protected abstract java.lang.Object _rawOfString(java.lang.String string)
throws ParsingPoemException
ParsingPoemException
public final java.lang.Object rawOfString(java.lang.String string)
throws ParsingPoemException,
ValidationPoemException
String to a low level
representation of a valid database column value.
Null values are not changed.
This result is validated with assertValidRaw(Object)
whereas stringOfRaw(Object) assumes this is not
required.
Get an Object from its String representation.
rawOfString in interface PoemTypestring - the String representation to convert
ParsingPoemException - if the String representation is not well formed
ValidationPoemException - if the raw has an illegal valuePoemType.rawOfString(java.lang.String)
protected abstract void _assertValidCooked(java.lang.Object cooked)
throws ValidationPoemException
ValidationPoemException
public final void assertValidCooked(java.lang.Object cooked)
throws ValidationPoemException
assertValidCooked in interface PoemTypecooked - the Object to check
ValidationPoemException - if the raw has an illegal valuePoemType.assertValidCooked(java.lang.Object)
protected abstract java.lang.Object _cookedOfRaw(java.lang.Object raw)
throws PoemException
For the base object types, (String, Integer etc) this involves no change.
For types with an integer id, such as Poem internal types and user defined types, then the appropriate instantiated type is returned from its Integer id.
raw - the base object or Integer object id
PoemException
public final java.lang.Object cookedOfRaw(java.lang.Object raw)
throws PoemException
The raw value is checked to ensure it is valid. Create an Object from a raw Object, a no-op for all but ReferencePoemTypes.
cookedOfRaw in interface PoemTyperaw - the object, typically a troid
TypeMismatchPoemException - if the raw is of the wrong type
PoemException - if there is another problem, such as no object with that troidPoemType.cookedOfRaw(java.lang.Object)
protected abstract java.lang.Object _rawOfCooked(java.lang.Object raw)
throws PoemException
PoemExceptionpublic final java.lang.Object rawOfCooked(java.lang.Object cooked)
rawOfCooked in interface PoemTypecooked - the Persistent or Object
PoemType.rawOfCooked(java.lang.Object)
protected abstract java.lang.String _stringOfCooked(java.lang.Object cooked,
PoemLocale locale,
int style)
throws PoemException
PoemException
public final java.lang.String stringOfCooked(java.lang.Object cooked,
PoemLocale locale,
int style)
throws PoemException
stringOfCooked in interface PoemTypestyle - as in java.text.DateFormat.SHORT, ...
TypeMismatchPoemException - if the raw is of the wrong type
PoemException - if there is an access violationPoemType.stringOfCooked(java.lang.Object,
org.melati.poem.PoemLocale, int)public final boolean getNullable()
getNullable in interface PoemTypePoemType.getNullable()public final int sqlTypeCode()
sqlTypeCode in interface SQLTypeSQLType.sqlTypeCode()protected abstract java.lang.String _sqlDefinition(Dbms dbms)
public java.lang.String sqlDefinition(Dbms dbms)
STRING NOT NULL
sqlDefinition in interface SQLTypedbms - the DBMS
SQLType.sqlDefinition(org.melati.poem.dbms.Dbms)public java.lang.String sqlTypeDefinition(Dbms dbms)
STRING
sqlTypeDefinition in interface SQLTypedbms - the DBMS
SQLType.sqlTypeDefinition(org.melati.poem.dbms.Dbms)protected abstract boolean _canRepresent(SQLPoemType other)
public PoemType canRepresent(PoemType other)
canRepresent in interface PoemTypeother - the other type to check
PoemType.canRepresent(org.melati.poem.PoemType)public final PoemType withNullable(boolean nullableP)
withNullable in interface PoemTypenullableP - the nullability we want
PoemType.withNullable(boolean)
protected abstract void _saveColumnInfo(ColumnInfo info)
throws AccessPoemException
AccessPoemException
public void saveColumnInfo(ColumnInfo info)
throws AccessPoemException
saveColumnInfo in interface PoemTypeinfo - the ColumnInfo to set the type of
AccessPoemException - if our AccessToken does not permit modificationPoemType.saveColumnInfo(org.melati.poem.ColumnInfo)protected abstract java.lang.String _quotedRaw(java.lang.Object raw)
public java.lang.String quotedRaw(java.lang.Object raw)
throws ValidationPoemException
numbers and booleans are not quoted for most dbms'.
quotedRaw in interface SQLTyperaw - sql value
ValidationPoemExceptionSQLType.quotedRaw(java.lang.Object)protected abstract java.lang.String _toString()
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()protected java.lang.Object clone()
clone in class java.lang.ObjectObject.clone()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||