public final class DefaultTypeManager extends Object implements TypeManager, KnownImmutable
Manages the list of ScalarType that is available.
| Constructor and Description |
|---|
DefaultTypeManager(ServerConfig config,
BootupClasses bootupClasses)
Create the DefaultTypeManager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ScalarType<?> scalarType)
Register a custom ScalarType.
|
CheckImmutableResponse |
checkImmutable(Class<?> cls)
Check if the type is immutable using reflection.
|
Object |
convert(Object value,
int toJdbcType)
Convert the Object to the required datatype.
|
protected CtCompoundType |
createCompoundScalarDataReader(Class<?> compoundTypeClass,
CompoundType<?> compoundType,
String info) |
ScalarType<?> |
createEnumScalarType(Class<?> enumType)
Create a ScalarType for an Enum that has additional mapping.
|
CtCompoundType<?> |
getCompoundType(Class<?> type)
Return the Internal CompoundType handler for a given compound type.
|
ScalarDataReader<?> |
getScalarDataReader(Class<?> type) |
ScalarDataReader<?> |
getScalarDataReader(Class<?> propertyType,
int sqlType) |
<T> ScalarType<T> |
getScalarType(Class<T> type)
This can return null if no matching ScalarType is found.
|
<T> ScalarType<T> |
getScalarType(Class<T> type,
int jdbcType)
Return a ScalarType for a given class.
|
ScalarType<?> |
getScalarType(int jdbcType)
Return the ScalarType for the given jdbc type as per java.sql.Types.
|
protected void |
initialiseCompoundTypes(BootupClasses bootupClasses) |
protected void |
initialiseCustomScalarTypes(BootupClasses bootupClasses)
Automatically find any ScalarTypes by searching through the class path.
|
protected void |
initialiseJodaTypes()
Detect if Joda classes are in the classpath and if so register the Joda
data types.
|
protected void |
initialiseScalarConverters(BootupClasses bootupClasses) |
protected void |
initialiseStandard(int platformClobType,
int platformBlobType)
Register all the standard types supported.
|
boolean |
isKnownImmutable(Class<?> cls) |
protected void |
logAdd(ScalarType<?> scalarType) |
ScalarDataReader<?> |
recursiveCreateScalarDataReader(Class<?> cls)
Create ScalarDataReader's for the Immutable compound type.
|
ScalarType<?> |
recursiveCreateScalarTypes(Class<?> cls)
Create ScalarTypes for this Immutable Value Object type.
|
public DefaultTypeManager(ServerConfig config, BootupClasses bootupClasses)
public boolean isKnownImmutable(Class<?> cls)
isKnownImmutable in interface KnownImmutablepublic CheckImmutableResponse checkImmutable(Class<?> cls)
TypeManagercheckImmutable in interface TypeManagerpublic ScalarDataReader<?> recursiveCreateScalarDataReader(Class<?> cls)
TypeManagerrecursiveCreateScalarDataReader in interface TypeManagerpublic ScalarType<?> recursiveCreateScalarTypes(Class<?> cls)
TypeManagerrecursiveCreateScalarTypes in interface TypeManagerpublic void add(ScalarType<?> scalarType)
add in interface TypeManagerprotected void logAdd(ScalarType<?> scalarType)
public CtCompoundType<?> getCompoundType(Class<?> type)
TypeManagergetCompoundType in interface TypeManagerpublic ScalarType<?> getScalarType(int jdbcType)
getScalarType in interface TypeManagerjdbcType - as per java.sql.Typespublic <T> ScalarType<T> getScalarType(Class<T> type)
getScalarType in interface TypeManagerpublic ScalarDataReader<?> getScalarDataReader(Class<?> propertyType, int sqlType)
public ScalarDataReader<?> getScalarDataReader(Class<?> type)
public <T> ScalarType<T> getScalarType(Class<T> type, int jdbcType)
Used for java.util.Date and java.util.Calendar which can be mapped to different jdbcTypes in a single system.
getScalarType in interface TypeManagerpublic Object convert(Object value, int toJdbcType)
value - the Object valuetoJdbcType - the type as per java.sql.Types.public ScalarType<?> createEnumScalarType(Class<?> enumType)
The reason for this is that often in a DB there will be short codes used such as A,I,N rather than the ACTIVE, INACTIVE, NEW. So there really needs to be a mapping from the nicely named enumeration values to the typically much shorter codes used in the DB.
createEnumScalarType in interface TypeManagerprotected void initialiseCustomScalarTypes(BootupClasses bootupClasses)
In avaje.properties define a list of packages in which ScalarTypes are found. This will search for any class that implements the ScalarType interface and register it with this TypeManager.
protected void initialiseScalarConverters(BootupClasses bootupClasses)
protected void initialiseCompoundTypes(BootupClasses bootupClasses)
protected CtCompoundType createCompoundScalarDataReader(Class<?> compoundTypeClass, CompoundType<?> compoundType, String info)
protected void initialiseJodaTypes()
protected void initialiseStandard(int platformClobType,
int platformBlobType)
Copyright © 2014. All Rights Reserved.