FileDocCategorySizeDatePackage
CharacterType.javaAPI DocHibernate 3.2.51615Wed Aug 10 15:23:56 BST 2005org.hibernate.type

CharacterType

public class CharacterType extends PrimitiveType implements DiscriminatorType
character: A type that maps an SQL CHAR(1) to a Java Character.
author
Gavin King

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ObjectfromStringValue(java.lang.String xml)

		return new Character( xml.charAt(0) );
	
public java.lang.Objectget(java.sql.ResultSet rs, java.lang.String name)

		String str = rs.getString(name);
		if (str==null) {
			return null;
		}
		else {
			return new Character( str.charAt(0) );
		}
	
public java.io.SerializablegetDefaultValue()

		throw new UnsupportedOperationException("not a valid id type");
	
public java.lang.StringgetName()

 return "character"; 
public java.lang.ClassgetPrimitiveClass()

		return char.class;
	
public java.lang.ClassgetReturnedClass()

		return Character.class;
	
public java.lang.StringobjectToSQLString(java.lang.Object value, org.hibernate.dialect.Dialect dialect)

		return '\'" + value.toString() + '\'";
	
public voidset(java.sql.PreparedStatement st, java.lang.Object value, int index)

		st.setString( index, (value).toString() );
	
public intsqlType()

		return Types.CHAR;
	
public java.lang.ObjectstringToObject(java.lang.String xml)

		if ( xml.length() != 1 ) throw new MappingException("multiple or zero characters found parsing string");
		return new Character( xml.charAt(0) );