public class CachingReflectionTypeFactory extends ReflectionTypeFactory
JvmDeclaredType
per Class
.
The mechanism is based on the assumption that the same class loader is used during the lifetime of the type factory.
The cached type
is not contained in a resource / resource set and contains proxies. If a
client requests a type, the cached instance is EcoreUtil.copied and the copy is delivered.
This class is mainly useful for unit tests where the number of
used resource sets is rather big compared to the number of loaded types,
e.g. the evaluation tests with about 500 test cases will request the
extension types at least 500 times thus caching those types greatly reduces the execution time.
Real world use cases like the command line compiler for Xtend will usually not benefit from cached
types
since only one resource set is involved which maintains an index of resolved
types.ITypeFactory.OptionsAware<TypeData,Type extends JvmType>
Constructor and Description |
---|
CachingReflectionTypeFactory(ReflectionTypeFactory delegate) |
Modifier and Type | Method and Description |
---|---|
JvmDeclaredType |
createType(java.lang.Class<?> clazz)
Creates a new
type from the given class. |
createAnnotationProxy, createAnnotationReference, createAnnotationType, createAnnotationValue, createAnnotationValue, createAnnotationValues, createArrayAnnotationValue, createArrayTypeReference, createConstructor, createConstructors, createEnumerationType, createEnumLiteralProxy, createField, createFields, createFormalParameter, createLocalArrayTypeReference, createLocalTypeReference, createMethodProxy, createMethods, createNestedTypes, createOperation, createProxy, createTypeArgument, createTypeParameter, createTypeReference, enhanceExecutable, enhanceGenericDeclaration, getUriHelper, isLocal, logSignatureFormatError, setSuperTypes, setTypeModifiers, setVisibility, setVisibility
public CachingReflectionTypeFactory(ReflectionTypeFactory delegate)
public JvmDeclaredType createType(java.lang.Class<?> clazz)
ReflectionTypeFactory
type
from the given class.createType
in interface ITypeFactory<java.lang.Class<?>,JvmDeclaredType>
createType
in class ReflectionTypeFactory