java.lang.Object
com.codebox.builders.ExtensionBuilder<T>
- Type Parameters:
T
- the type to extend
ExtensionBuilder dynamically generates a subclass of the given class with additional String properties and their
getters/setters.
Uses Javassist to create a new class at runtime named clazz.getName() + "Extension"
. The generated class
will have four String properties: jbExtension1, jbExtension2, jbExtension3, jbExtension4.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ExtensionBuilder
public ExtensionBuilder()
-
-
Method Details
-
generate
public Class<?> generate(Class<T> clazz) throws javassist.NotFoundException, javassist.CannotCompileException Generates a dynamic subclass of the given class with additional String properties and their getters/setters.- Parameters:
clazz
- the class to extend- Returns:
- the generated class
- Throws:
javassist.NotFoundException
- if the class cannot be found in the class pooljavassist.CannotCompileException
- if the class cannot be compiled
-