net.java.ao.types
Class TypeInfo<T>

java.lang.Object
  extended by net.java.ao.types.TypeInfo<T>

public final class TypeInfo<T>
extends Object

Describes a mapping between a LogicalType, with optional qualifiers, and the underlying database type.

The database provider constructs one instance of this class for each supported logical type, and may provide additional derived instances for specific entity properties. The caller will never construct an instance of this class directly.


Constructor Summary
  TypeInfo(LogicalType<T> logicalType, SchemaProperties schemaProperties, TypeQualifiers defaultQualifiers)
           
protected TypeInfo(LogicalType<T> logicalType, SchemaProperties schemaProperties, TypeQualifiers defaultQualifiers, TypeQualifiers qualifiers)
           
 
Method Summary
 boolean acceptsQualifiers(TypeQualifiers qualifiers)
          Returns true if this type is compatible with the given qualifiers.
 boolean equals(Object other)
           
 int getJdbcWriteType()
          Returns the JDBC type code to use when passing values to the database.
 LogicalType<T> getLogicalType()
          Returns the LogicalType describing what Java types are supported by this type and how they are mapped to JDBC operations.
 TypeQualifiers getQualifiers()
          Returns the TypeQualifiers describing optional length/precision modifiers for this type, which may include defaults set by the database provider and/or values specified by annotations for particular entity properties.
 SchemaProperties getSchemaProperties()
          Returns the SchemaProperties describing the SQL representation of this type, as specified by the database provider.
 String getSqlTypeIdentifier()
          Returns the SQL type identifier for this type, including any length or precision modifiers.
 int hashCode()
           
 boolean isAllowedAsPrimaryKey()
          Returns a boolean specifying if this type can be used as a primary key value.
 String toString()
          Describes the type mapping in a format that includes the logical type name, any non-default qualifiers, and the SQL type name, e.g.
 TypeInfo<T> withQualifiers(TypeQualifiers qualifiers)
          Returns a new instance of this class with the same properties, but with the default TypeQualifiers overridden by the specified values.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TypeInfo

public TypeInfo(LogicalType<T> logicalType,
                SchemaProperties schemaProperties,
                TypeQualifiers defaultQualifiers)

TypeInfo

protected TypeInfo(LogicalType<T> logicalType,
                   SchemaProperties schemaProperties,
                   TypeQualifiers defaultQualifiers,
                   TypeQualifiers qualifiers)
Method Detail

getLogicalType

public LogicalType<T> getLogicalType()
Returns the LogicalType describing what Java types are supported by this type and how they are mapped to JDBC operations.


getSchemaProperties

public SchemaProperties getSchemaProperties()
Returns the SchemaProperties describing the SQL representation of this type, as specified by the database provider.


getQualifiers

public TypeQualifiers getQualifiers()
Returns the TypeQualifiers describing optional length/precision modifiers for this type, which may include defaults set by the database provider and/or values specified by annotations for particular entity properties.


isAllowedAsPrimaryKey

public boolean isAllowedAsPrimaryKey()
Returns a boolean specifying if this type can be used as a primary key value.

Returns:
if it's allowed or not

getSqlTypeIdentifier

public String getSqlTypeIdentifier()
Returns the SQL type identifier for this type, including any length or precision modifiers.


getJdbcWriteType

public int getJdbcWriteType()
Returns the JDBC type code to use when passing values to the database. This is based on the default value from the LogicalType but can be overridden by each database provider in the SchemaProperties.


withQualifiers

public TypeInfo<T> withQualifiers(TypeQualifiers qualifiers)
Returns a new instance of this class with the same properties, but with the default TypeQualifiers overridden by the specified values.

Throws:
ActiveObjectsConfigurationException - if the qualifiers are not allowed for this type

acceptsQualifiers

public boolean acceptsQualifiers(TypeQualifiers qualifiers)
Returns true if this type is compatible with the given qualifiers.


equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Describes the type mapping in a format that includes the logical type name, any non-default qualifiers, and the SQL type name, e.g. "String(255):VARCHAR".

Overrides:
toString in class Object


Copyright © 2007-2014. All Rights Reserved.