public class TypeManager extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected Map<String,TypeConverter> |
autoApplyConvertersByType |
protected ClassLoaderResolver |
clr |
protected Map<String,TypeConverter> |
convertersByName
Map of TypeConverter keyed by their symbolic name.
|
protected Map<String,org.datanucleus.store.types.TypeManager.JavaType> |
javaTypes
Map of java types, keyed by the class name.
|
protected NucleusContext |
nucCtx |
protected Map<Class,Map<Class,TypeConverter>> |
typeConverterMap
Map of (Map of TypeConverter keyed by the datastore type), keyed by the member type.
|
Constructor and Description |
---|
TypeManager(NucleusContext nucCtx)
Constructor, loading support for type mappings using the plugin mechanism.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addJavaType(org.datanucleus.store.types.TypeManager.JavaType type) |
String[] |
filterOutSupportedSecondClassNames(String[] inputClassNames)
Convenience method to filter out any supported classes from a list.
|
protected org.datanucleus.store.types.TypeManager.JavaType |
findJavaTypeForClass(Class cls)
Convenience method to return the JavaType for the specified class.
|
protected org.datanucleus.store.types.TypeManager.JavaType |
findJavaTypeForCollectionClass(Class cls,
Class genericType)
Convenience method to return the JavaType for the specified class.
|
TypeConverter |
getAutoApplyTypeConverterFortype(Class memberType) |
protected ClassLoaderResolver |
getClassLoaderResolver() |
static Class |
getDatastoreTypeForTypeConverter(TypeConverter conv,
Class memberType) |
TypeConverter |
getDefaultTypeConverterForType(Class memberType)
Accessor for the default type converter for the provided Java type.
|
static Class |
getMemberTypeForTypeConverter(TypeConverter conv,
Class datastoreType) |
Set<String> |
getSupportedSecondClassTypes()
Accessor for the supported second-class Types.
|
TypeConverter |
getTypeConverterForName(String converterName)
Accessor for the type converter with the provided name.
|
TypeConverter |
getTypeConverterForType(Class memberType,
Class datastoreType)
Accessor for the type converter for the provided Java type and its datastore type.
|
Class |
getTypeForSecondClassWrapper(String className)
Accessor for a java type that the supplied class is a SCO wrapper for.
|
Class |
getWrappedTypeBackedForType(String className)
Accessor for the backing-store Second Class Wrapper class for the supplied class.
|
Class |
getWrapperTypeForType(String className)
Accessor for the SCO wrapper for the type
|
boolean |
isDefaultEmbeddedType(Class c)
Accessor for whether the type is by default embedded.
|
boolean |
isDefaultFetchGroup(Class c)
Accessor for whether the type is by default in the DFG.
|
boolean |
isDefaultFetchGroupForCollection(Class c,
Class genericType)
Accessor for whether the generic collection type is by default in the DFG.
|
boolean |
isDefaultPersistent(Class c)
Accessor for whether the type is by default persistent.
|
boolean |
isSecondClassMutableType(String className)
Accessor for whether the type is SCO mutable.
|
boolean |
isSecondClassWrapper(String className)
Accessor for whether the type is a SCO wrapper itself.
|
boolean |
isSupportedSecondClassType(String className)
Accessor for whether a class is supported as being second class.
|
void |
registerConverter(String name,
TypeConverter converter)
TypeConverters are registered either from the contents of "plugin.xml" (i.e the builtin types) where the
name is of the form "dn.*", or from user-registered metadata (e.g JPA Annotations) where the name is
the class name of the converter.
|
void |
registerConverter(String name,
TypeConverter converter,
boolean autoApply,
String autoApplyType)
Register a TypeConverter with the TypeManager process.
|
protected NucleusContext nucCtx
protected transient ClassLoaderResolver clr
protected Map<String,org.datanucleus.store.types.TypeManager.JavaType> javaTypes
protected Map<String,TypeConverter> convertersByName
protected Map<String,TypeConverter> autoApplyConvertersByType
protected Map<Class,Map<Class,TypeConverter>> typeConverterMap
public TypeManager(NucleusContext nucCtx)
nucCtx
- NucleusContextprotected ClassLoaderResolver getClassLoaderResolver()
public Set<String> getSupportedSecondClassTypes()
public boolean isSupportedSecondClassType(String className)
className
- The class namepublic String[] filterOutSupportedSecondClassNames(String[] inputClassNames)
inputClassNames
- Names of the classespublic boolean isDefaultPersistent(Class c)
c
- The typepublic boolean isDefaultFetchGroup(Class c)
c
- The typepublic boolean isDefaultFetchGroupForCollection(Class c, Class genericType)
c
- The typegenericType
- The element generic typepublic boolean isDefaultEmbeddedType(Class c)
c
- The typepublic boolean isSecondClassMutableType(String className)
className
- The typepublic Class getWrapperTypeForType(String className)
className
- The typepublic Class getWrappedTypeBackedForType(String className)
className
- The class namepublic boolean isSecondClassWrapper(String className)
className
- The typepublic Class getTypeForSecondClassWrapper(String className)
className
- Name of the classpublic TypeConverter getTypeConverterForName(String converterName)
converterName
- Name of the converterpublic void registerConverter(String name, TypeConverter converter, boolean autoApply, String autoApplyType)
name
- The name to register the converter underconverter
- The converterautoApply
- Whether this should be used as an auto-apply converterpublic void registerConverter(String name, TypeConverter converter)
name
- The name to register the converter underconverter
- The converterpublic TypeConverter getAutoApplyTypeConverterFortype(Class memberType)
public TypeConverter getDefaultTypeConverterForType(Class memberType)
memberType
- Java type for the memberpublic TypeConverter getTypeConverterForType(Class memberType, Class datastoreType)
memberType
- Java type for the memberdatastoreType
- Java type for the datastoreprotected org.datanucleus.store.types.TypeManager.JavaType findJavaTypeForClass(Class cls)
cls
- The class requiredprotected org.datanucleus.store.types.TypeManager.JavaType findJavaTypeForCollectionClass(Class cls, Class genericType)
cls
- The class requiredprotected void addJavaType(org.datanucleus.store.types.TypeManager.JavaType type)
public static Class getMemberTypeForTypeConverter(TypeConverter conv, Class datastoreType)
public static Class getDatastoreTypeForTypeConverter(TypeConverter conv, Class memberType)
Copyright © 2021. All rights reserved.