|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.access.types.AbstractType
org.apache.cayenne.access.types.CharType
public class CharType
Handles java.lang.String
, mapping it as either of JDBC types - CLOB or
(VAR)CHAR. Can be configured to trim trailing spaces.
Field Summary | |
---|---|
protected boolean |
trimmingChars
|
protected boolean |
usingClobs
|
Constructor Summary | |
---|---|
CharType(boolean trimingChars,
boolean usingClobs)
|
Method Summary | |
---|---|
String |
getClassName()
Returns "java.lang.String". |
boolean |
isTrimmingChars()
Returns true if 'materializeObject' method should trim trailing
spaces from the CHAR columns. |
boolean |
isUsingClobs()
|
Object |
materializeObject(CallableStatement cs,
int index,
int type)
Return trimmed string. |
Object |
materializeObject(ResultSet rs,
int index,
int type)
Return trimmed string. |
protected String |
readCharStream(ResultSet rs,
int index)
|
protected String |
readClob(Clob clob)
|
protected String |
readValueStream(Reader in,
int streamSize,
int bufSize)
|
void |
setJdbcObject(PreparedStatement st,
Object val,
int pos,
int type,
int precision)
Calls "PreparedStatement.setObject(..)". |
void |
setTrimmingChars(boolean trimingChars)
|
void |
setUsingClobs(boolean usingClobs)
|
boolean |
validateProperty(Object source,
String property,
Object value,
DbAttribute dbAttribute,
ValidationResult validationResult)
Deprecated. since 3.0 as validation should not be done at the DataNode level. |
Methods inherited from class org.apache.cayenne.access.types.AbstractType |
---|
toString, validateNull |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean trimmingChars
protected boolean usingClobs
Constructor Detail |
---|
public CharType(boolean trimingChars, boolean usingClobs)
Method Detail |
---|
public String getClassName()
getClassName
in interface ExtendedType
getClassName
in class AbstractType
public boolean validateProperty(Object source, String property, Object value, DbAttribute dbAttribute, ValidationResult validationResult)
validateProperty
in interface ExtendedType
validateProperty
in class AbstractType
public Object materializeObject(ResultSet rs, int index, int type) throws Exception
materializeObject
in interface ExtendedType
materializeObject
in class AbstractType
Exception
- if read error ocurred, or an object can't be converted to a
target Java class.public Object materializeObject(CallableStatement cs, int index, int type) throws Exception
materializeObject
in interface ExtendedType
materializeObject
in class AbstractType
Exception
- if read error ocurred, or an object can't be converted to a
target Java class.public void setJdbcObject(PreparedStatement st, Object val, int pos, int type, int precision) throws Exception
AbstractType
setJdbcObject
in interface ExtendedType
setJdbcObject
in class AbstractType
Exception
protected String readClob(Clob clob) throws IOException, SQLException
IOException
SQLException
protected String readCharStream(ResultSet rs, int index) throws IOException, SQLException
IOException
SQLException
protected String readValueStream(Reader in, int streamSize, int bufSize) throws IOException
IOException
public boolean isTrimmingChars()
true
if 'materializeObject' method should trim trailing
spaces from the CHAR columns. This addresses an issue with some JDBC drivers (e.g.
Oracle), that return Strings for CHAR columsn padded with spaces.
public void setTrimmingChars(boolean trimingChars)
public boolean isUsingClobs()
public void setUsingClobs(boolean usingClobs)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |