public class ClassGeneratorProvider extends Object implements FactoryProvider
Modifier and Type | Class and Description |
---|---|
static class |
ClassGeneratorProvider.LocalClassLoader
Class loader to use to call
ClassGeneratorProvider.LocalClassLoader.defineClass(String, byte[]) . |
Constructor and Description |
---|
ClassGeneratorProvider(String targetPackage)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
<T> EventFactory<T> |
create(Class<T> type,
Class<?> parentType,
List<? extends EventFactoryPlugin> plugins)
Creates a function that takes a map of property names with their
values to create a new instance of a generated class that implements
the given type.
|
ClassGeneratorProvider.LocalClassLoader |
getClassLoader()
Gets the
ClassGeneratorProvider.LocalClassLoader used to load generated event classes. |
protected String |
getClassName(Class<?> clazz,
String classifier)
Get the canonical name used for a generated event class.
|
NullPolicy |
getNullPolicy()
Get whether there should be any checks on whether a parameter is
null when it should not be.
|
void |
setNullPolicy(NullPolicy nullPolicy)
Set whether there should be any checks on whether a parameter is
null when it should not be.
|
public ClassGeneratorProvider(String targetPackage)
targetPackage
- The target package to place generated event classes inpublic NullPolicy getNullPolicy()
FactoryProvider
getNullPolicy
in interface FactoryProvider
public void setNullPolicy(NullPolicy nullPolicy)
FactoryProvider
setNullPolicy
in interface FactoryProvider
nullPolicy
- The null policyprotected String getClassName(Class<?> clazz, String classifier)
clazz
- The classclassifier
- The classifierpublic <T> EventFactory<T> create(Class<T> type, Class<?> parentType, List<? extends EventFactoryPlugin> plugins)
FactoryProvider
create
in interface FactoryProvider
T
- The type of the eventtype
- The type to generate a class forparentType
- The parent typeplugins
- The EventFactoryPlugin
s to use when generating the classpublic ClassGeneratorProvider.LocalClassLoader getClassLoader()
ClassGeneratorProvider.LocalClassLoader
used to load generated event classes.ClassGeneratorProvider.LocalClassLoader