|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 | |
---|---|
java.lang.String |
getClassName()
Returns "java.lang.String". |
boolean |
isTrimmingChars()
Returns true if 'materializeObject' method should trim trailing spaces
from the CHAR columns. |
boolean |
isUsingClobs()
|
java.lang.Object |
materializeObject(java.sql.CallableStatement cs,
int index,
int type)
Return trimmed string. |
java.lang.Object |
materializeObject(java.sql.ResultSet rs,
int index,
int type)
Return trimmed string. |
protected java.lang.String |
readCharStream(java.sql.ResultSet rs,
int index)
|
protected java.lang.String |
readClob(java.sql.Clob clob)
|
protected java.lang.String |
readValueStream(java.io.Reader in,
int streamSize,
int bufSize)
|
protected java.lang.String |
rtrim(java.lang.String value)
Trim right spaces. |
void |
setJdbcObject(java.sql.PreparedStatement st,
java.lang.Object value,
int pos,
int type,
int scale)
Initializes a single parameter of a PreparedStatement with object value. |
void |
setTrimmingChars(boolean trimingChars)
|
void |
setUsingClobs(boolean usingClobs)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean trimmingChars
protected boolean usingClobs
Constructor Detail |
---|
public CharType(boolean trimingChars, boolean usingClobs)
Method Detail |
---|
public java.lang.String getClassName()
getClassName
in interface ExtendedType
public java.lang.Object materializeObject(java.sql.ResultSet rs, int index, int type) throws java.lang.Exception
materializeObject
in interface ExtendedType
java.lang.Exception
- if read error occurred, or an object can't be converted to a
target Java class.public java.lang.Object materializeObject(java.sql.CallableStatement cs, int index, int type) throws java.lang.Exception
materializeObject
in interface ExtendedType
java.lang.Exception
- if read error ocurred, or an object can't be converted to a
target Java class.protected java.lang.String rtrim(java.lang.String value)
public void setJdbcObject(java.sql.PreparedStatement st, java.lang.Object value, int pos, int type, int scale) throws java.lang.Exception
ExtendedType
setJdbcObject
in interface ExtendedType
java.lang.Exception
protected java.lang.String readClob(java.sql.Clob clob) throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected java.lang.String readCharStream(java.sql.ResultSet rs, int index) throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected java.lang.String readValueStream(java.io.Reader in, int streamSize, int bufSize) throws java.io.IOException
java.io.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 |