public class BytecodeRecorderImpl extends Object implements RecorderContext
A class template is simple a stateless class with a no arg constructor. This template will contain the runtime logic used to bootstrap the various frameworks.
A recording proxy is a proxy of a template that records all invocations on the template, and then writes out a sequence of java bytecode that performs the same invocations.
There are some limitations on what can be recorded. Only the following objects are allowed as parameters to recording proxies:
- primitives
- String
- Class (see classProxy(String) to handle classes that are not loadable at generation time)
- Objects with a no-arg constructor and getter/setters for all properties
- Any arbitrary object via the registerSubstitution(Class, Class, Class) mechanism
- arrays, lists and maps of the above
| Modifier and Type | Class and Description |
|---|---|
(package private) static interface |
BytecodeRecorderImpl.BytecodeInstruction |
(package private) static class |
BytecodeRecorderImpl.NewInstance |
(package private) static class |
BytecodeRecorderImpl.NonDefaultConstructorHolder |
static interface |
BytecodeRecorderImpl.ReturnedProxy |
(package private) static class |
BytecodeRecorderImpl.StoredMethodCall |
(package private) static class |
BytecodeRecorderImpl.SubstitutionHolder |
| Constructor and Description |
|---|
BytecodeRecorderImpl(boolean staticInit,
String buildStepName,
String methodName) |
BytecodeRecorderImpl(ClassLoader classLoader,
boolean staticInit,
String className) |
| Modifier and Type | Method and Description |
|---|---|
(package private) static io.quarkus.gizmo.ResultHandle |
arrayValue(org.jboss.jandex.AnnotationValue value,
io.quarkus.gizmo.BytecodeCreator valueMethod,
org.jboss.jandex.MethodInfo method,
org.jboss.jandex.ClassInfo annotationClass) |
Class<?> |
classProxy(String name)
Creates a Class instance that can be passed to a recording proxy as a substitute for a class that is not loadable
at processing time.
|
(package private) static String |
componentType(org.jboss.jandex.MethodInfo method) |
String |
getClassName() |
<T> T |
getRecordingProxy(Class<T> theClass) |
boolean |
isEmpty() |
(package private) static io.quarkus.gizmo.ResultHandle |
loadValue(io.quarkus.gizmo.BytecodeCreator valueMethod,
org.jboss.jandex.AnnotationValue value,
org.jboss.jandex.ClassInfo annotationClass,
org.jboss.jandex.MethodInfo method) |
<T> RuntimeValue<T> |
newInstance(String name)
Creates a RuntimeValue object that represents an object created via the default constructor.
|
<T> void |
registerNonDefaultConstructor(Constructor<T> constructor,
Function<T,List<Object>> parameters)
Registers a way to construct an object via a non-default constructor.
|
void |
registerObjectLoader(ObjectLoader loader)
Register an object loader.
|
<F,T> void |
registerSubstitution(Class<F> from,
Class<T> to,
Class<? extends ObjectSubstitution<F,T>> substitution)
Registers a substitution to allow objects that are not serialisable to bytecode to be substituted for an object
that is.
|
void |
writeBytecode(ClassOutput classOutput) |
public BytecodeRecorderImpl(ClassLoader classLoader, boolean staticInit, String className)
public boolean isEmpty()
public <F,T> void registerSubstitution(Class<F> from, Class<T> to, Class<? extends ObjectSubstitution<F,T>> substitution)
RecorderContextregisterSubstitution in interface RecorderContextfrom - The class of the non serializable objectto - The class to serialize tosubstitution - The subclass of ObjectSubstitution that performs the substitutionpublic <T> void registerNonDefaultConstructor(Constructor<T> constructor, Function<T,List<Object>> parameters)
RecorderContextregisterNonDefaultConstructor in interface RecorderContextT - The type of the objectconstructor - The constructorparameters - A function that maps the object to a list of constructor parameterspublic void registerObjectLoader(ObjectLoader loader)
RecorderContextregisterObjectLoader in interface RecorderContextloader - the object loader (must not be null)public <T> T getRecordingProxy(Class<T> theClass)
public Class<?> classProxy(String name)
RecorderContextclassProxy in interface RecorderContextname - The class namepublic <T> RuntimeValue<T> newInstance(String name)
RecorderContextThis object can be passed into templates, but must not be used directly at deployment time
newInstance in interface RecorderContextT - The type of the classname - The name of the classpublic String getClassName()
public void writeBytecode(ClassOutput classOutput)
static io.quarkus.gizmo.ResultHandle loadValue(io.quarkus.gizmo.BytecodeCreator valueMethod,
org.jboss.jandex.AnnotationValue value,
org.jboss.jandex.ClassInfo annotationClass,
org.jboss.jandex.MethodInfo method)
static io.quarkus.gizmo.ResultHandle arrayValue(org.jboss.jandex.AnnotationValue value,
io.quarkus.gizmo.BytecodeCreator valueMethod,
org.jboss.jandex.MethodInfo method,
org.jboss.jandex.ClassInfo annotationClass)
static String componentType(org.jboss.jandex.MethodInfo method)
Copyright © 2019 JBoss by Red Hat. All rights reserved.