org.modeshape.jdbc
Class JcrType

java.lang.Object
  extended by org.modeshape.jdbc.JcrType

public final class JcrType
extends Object

Provides functionality to convert from JCR PropertyTypes and JDBC types.


Nested Class Summary
static class JcrType.DefaultDataTypes
           
 
Constructor Summary
protected JcrType(int jcrType, int jdbcType, String typeName, Class<?> clazz, int displaySize, int precision, Transform transform)
           
 
Method Summary
static Map<String,JcrType> builtInTypeMap()
          Get the immutable built-in map from the type names to the Java representation class.
 Integer getDefaultPrecision()
          Get the default precision used for this JcrType
 String getJcrName()
          Get the name of the JCR type.
 int getJcrType()
          Get the JCR PropertyType value.
 int getJdbcType()
          Get the JDBC JcrType.DefaultDataTypes value.
 String getJdbcTypeName()
          Get the native type name associated with the JDBC JcrType.DefaultDataTypes value.
 int getNominalDisplaySize()
          Get the nominal display size for the given type.
 Class<?> getRepresentationClass()
          Get the Java class used to represent values for this type.
protected  Transform getTransform()
          Return the Transform object to use to transform the Value to the correct data type.
 boolean isCaseSensitive()
          Get the indicator if the value is case sensitive
 boolean isSigned()
          Get the indicator if the value is considered a signed value.
 Object translateValue(Value value)
           
static Object translateValueToJDBC(Value value)
           
static JcrType typeInfo(int jcrType)
           
static JcrType typeInfo(String typeName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcrType

protected JcrType(int jcrType,
                  int jdbcType,
                  String typeName,
                  Class<?> clazz,
                  int displaySize,
                  int precision,
                  Transform transform)
Method Detail

getJcrName

public String getJcrName()
Get the name of the JCR type.

Returns:
the JCR type name; never null

getJcrType

public int getJcrType()
Get the JCR PropertyType value.

Returns:
the JCR property type; never null

getJdbcType

public int getJdbcType()
Get the JDBC JcrType.DefaultDataTypes value.

Returns:
the JDBC type; never null

getJdbcTypeName

public String getJdbcTypeName()
Get the native type name associated with the JDBC JcrType.DefaultDataTypes value.

Returns:
the native JDBC type name; never null

getDefaultPrecision

public Integer getDefaultPrecision()
Get the default precision used for this JcrType

Returns:
the Integer form of the precision

getTransform

protected Transform getTransform()
Return the Transform object to use to transform the Value to the correct data type.

Returns:
Transform

isCaseSensitive

public boolean isCaseSensitive()
Get the indicator if the value is case sensitive

Returns:
boolean indicating if the value is case sensitive

isSigned

public boolean isSigned()
Get the indicator if the value is considered a signed value.

Returns:
boolean indicating if value is signed.

getRepresentationClass

public Class<?> getRepresentationClass()
Get the Java class used to represent values for this type.

Returns:
the representation class; never null

getNominalDisplaySize

public int getNominalDisplaySize()
Get the nominal display size for the given type. This may not be large enough for certain string and binary values.

Returns:
the nominal display size; always positive
See Also:
ResultSetMetaData.getColumnDisplaySize(int)

translateValue

public Object translateValue(Value value)
                      throws SQLException
Throws:
SQLException

translateValueToJDBC

public static Object translateValueToJDBC(Value value)
                                   throws SQLException
Throws:
SQLException

builtInTypeMap

public static Map<String,JcrType> builtInTypeMap()
Get the immutable built-in map from the type names to the Java representation class.

Returns:
the built-in type map

typeInfo

public static JcrType typeInfo(String typeName)

typeInfo

public static JcrType typeInfo(int jcrType)


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.