Package org.apache.cayenne.access.types
Class CharType
java.lang.Object
org.apache.cayenne.access.types.CharType
- All Implemented Interfaces:
- ExtendedType<String>
- Direct Known Subclasses:
- H2CharType,- OracleCharType
Handles 
java.lang.String, mapping it as either of JDBC types -
 CLOB or (VAR)CHAR. Can be configured to trim trailing spaces.- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns "java.lang.String".booleanReturnstrueif 'materializeObject' method should trim trailing spaces from the CHAR columns.booleanmaterializeObject(CallableStatement cs, int index, int type) Reads an object from a stored procedure OUT parameter, converting it to class returned by 'getClassName' method.materializeObject(ResultSet rs, int index, int type) Return trimmed string.protected StringreadCharStream(ResultSet rs, int index) protected Stringprotected StringreadValueStream(Reader in, int streamSize, int bufSize) protected StringTrim right spaces.voidsetJdbcObject(PreparedStatement st, String value, int pos, int type, int scale) Initializes a single parameter of a PreparedStatement with object value.voidsetTrimmingChars(boolean trimingChars) voidsetUsingClobs(boolean usingClobs) Converts value of the supported type to a human-readable String representation.
- 
Field Details- 
trimmingCharsprotected boolean trimmingChars
- 
usingClobsprotected boolean usingClobs
 
- 
- 
Constructor Details- 
CharTypepublic CharType(boolean trimmingChars, boolean usingClobs) 
 
- 
- 
Method Details- 
getClassNameReturns "java.lang.String".- Specified by:
- getClassNamein interface- ExtendedType<String>
 
- 
materializeObjectReturn trimmed string.- Specified by:
- materializeObjectin interface- ExtendedType<String>
- Throws:
- Exception- if read error occurred, or an object can't be converted to a target Java class.
 
- 
materializeObjectDescription copied from interface:ExtendedTypeReads an object from a stored procedure OUT parameter, converting it to class returned by 'getClassName' method.- Specified by:
- materializeObjectin interface- ExtendedType<String>
- Throws:
- Exception- if read error occurred, or an object can't be converted to a target Java class.
 
- 
rtrimTrim right spaces.
- 
setJdbcObjectpublic void setJdbcObject(PreparedStatement st, String value, int pos, int type, int scale) throws Exception Description copied from interface:ExtendedTypeInitializes a single parameter of a PreparedStatement with object value.- Specified by:
- setJdbcObjectin interface- ExtendedType<String>
- Throws:
- Exception
 
- 
toStringDescription copied from interface:ExtendedTypeConverts value of the supported type to a human-readable String representation.- Specified by:
- toStringin interface- ExtendedType<String>
- Parameters:
- value- a value to convert to String.
 
- 
readClob- Throws:
- IOException
- SQLException
 
- 
readCharStream- Throws:
- IOException
- SQLException
 
- 
readValueStream- Throws:
- IOException
 
- 
isTrimmingCharspublic boolean isTrimmingChars()Returnstrueif '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 columns padded with spaces.
- 
setTrimmingCharspublic void setTrimmingChars(boolean trimingChars) 
- 
isUsingClobspublic boolean isUsingClobs()
- 
setUsingClobspublic void setUsingClobs(boolean usingClobs) 
 
-