public class ExtendedTypeMap extends Object
getRegisteredType(String)
documentation for lookup algorithm
details.Modifier and Type | Field and Description |
---|---|
protected ExtendedType |
defaultType |
protected Map<String,ExtendedType> |
typeMap |
Constructor and Description |
---|
ExtendedTypeMap()
Creates new ExtendedTypeMap, populating it with default JDBC-compatible types.
|
Modifier and Type | Method and Description |
---|---|
void |
addFactory(ExtendedTypeFactory factory)
Adds an ExtendedTypeFactory that will be consulted if no direct mapping for a given
class exists.
|
protected ExtendedType |
createType(String className)
Returns an ExtendedType for specific Java classes.
|
ExtendedType |
getDefaultType()
Returns a default ExtendedType that is used to handle unmapped types.
|
ExtendedType |
getRegisteredType(Class<?> javaClass)
Returns a type registered for the class name.
|
ExtendedType |
getRegisteredType(String javaClassName)
Returns a guaranteed non-null ExtendedType instance for a given Java class name.
|
String[] |
getRegisteredTypeNames()
Returns array of Java class names supported by Cayenne for JDBC mapping.
|
protected void |
initDefaultFactories()
Registers default factories for creating enum types and serializable types.
|
void |
registerType(ExtendedType type)
Adds a new type to the list of registered types.
|
void |
removeFactory(ExtendedTypeFactory factory)
Removes a factory from the registered factories if it was previously added.
|
void |
unregisterType(String javaClassName)
Removes registered ExtendedType object corresponding to
javaClassName
parameter. |
protected final Map<String,ExtendedType> typeMap
protected ExtendedType defaultType
public ExtendedTypeMap()
protected void initDefaultFactories()
public void addFactory(ExtendedTypeFactory factory)
Note that the order in which factories are added is important, as factories are consulted in turn when an ExtendedType is looked up, and lookup is stopped when any factory provides a non-null type.
public void removeFactory(ExtendedTypeFactory factory)
public void registerType(ExtendedType type)
type
argument, the old handler
is overridden by the new one.public ExtendedType getDefaultType()
public ExtendedType getRegisteredType(String javaClassName)
ExtendedTypeFactory
instances registered by users. If a factory returns a
non-null type, it is returned to the user and the rest of the factories are
ignored.ExtendedTypeFactory
instances that can dynamically construct extended types for serializable objects
and JDK 1.5 enums.public ExtendedType getRegisteredType(Class<?> javaClass)
public void unregisterType(String javaClassName)
javaClassName
parameter.public String[] getRegisteredTypeNames()
protected ExtendedType createType(String className)
ExtendedTypeFactory
factories to instantiate the
ExtendedType. All primitive classes must be converted to the corresponding Java
classes by the callers.Copyright © 2001–2014 Apache Cayenne. All rights reserved.