public class ClassGeneratingEntityInstantiator extends Object implements EntityInstantiator
EntityInstantiator
that can generate byte code to speed-up dynamic object instantiation. Uses the
PersistentEntity
's PreferredConstructor
to instantiate an instance of the entity by dynamically
generating factory methods with appropriate constructor invocations via ASM. If we cannot generate byte code for a
type, we gracefully fall-back to the ReflectionEntityInstantiator
.Modifier and Type | Class and Description |
---|---|
static interface |
ClassGeneratingEntityInstantiator.ObjectInstantiator
Needs to be public as otherwise the implementation class generated does not see the interface from the classloader.
|
Constructor and Description |
---|
ClassGeneratingEntityInstantiator()
Creates a new
ClassGeneratingEntityInstantiator . |
Modifier and Type | Method and Description |
---|---|
<T,E extends PersistentEntity<? extends T,P>,P extends PersistentProperty<P>> |
createInstance(E entity,
ParameterValueProvider<P> provider)
Creates a new instance of the given entity using the given source to pull data from.
|
protected EntityInstantiator |
doCreateEntityInstantiator(PersistentEntity<?,?> entity) |
public ClassGeneratingEntityInstantiator()
ClassGeneratingEntityInstantiator
.public <T,E extends PersistentEntity<? extends T,P>,P extends PersistentProperty<P>> T createInstance(E entity, ParameterValueProvider<P> provider)
EntityInstantiator
createInstance
in interface EntityInstantiator
entity
- will not be null.provider
- will not be null.protected EntityInstantiator doCreateEntityInstantiator(PersistentEntity<?,?> entity)
entity
- Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.