Class BytecodeRecorderImpl
- All Implemented Interfaces:
RecorderContext
A class recorder is simply a stateless class with a no arg constructor. This recorder will contain the runtime logic used to bootstrap the various frameworks.
A recording proxy is a proxy of a recorder that records all invocations on the recorder, 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
- Objects returned from a previous recorder invocation
- Objects with a no-arg constructor and getter/setters for all properties (or public fields)
- Objects with a constructor annotated with @RecordableConstructor with parameter names that match field names
- Any arbitrary object via the registerSubstitution(Class, Class, Class)
mechanism
- arrays, lists and maps of the above
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static interface
(package private) static final class
(package private) class
(package private) class
A bytecode serialized value.(package private) static final class
(package private) static interface
A group of instructions that will always be executed in the same methodstatic interface
(package private) static final class
(package private) final class
(package private) static final class
static interface
(package private) static interface
A step that must be executed to serialize a complex object(package private) static class
class responsible for splitting the bytecode into smaller methods, to make sure that even large objects and large numbers of invocations do not put us over the method limit.(package private) static final class
(package private) static final class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBytecodeRecorderImpl
(boolean staticInit, String buildStepName, String methodName, String uniqueHash, boolean useIdentityComparison) BytecodeRecorderImpl
(boolean staticInit, String buildStepName, String methodName, String uniqueHash, boolean useIdentityComparison, Function<Type, Object> configCreatorFunction) BytecodeRecorderImpl
(ClassLoader classLoader, boolean staticInit, String className) -
Method Summary
Modifier and TypeMethodDescription(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) <T> T
getRecordingProxy
(Class<T> theClass) boolean
isEmpty()
(package private) BytecodeRecorderImpl.DeferredParameter
loadValue
(org.jboss.jandex.AnnotationValue value, org.jboss.jandex.ClassInfo annotationClass, org.jboss.jandex.MethodInfo method) void
markClassAsConstructorRecordable
(Class<?> clazz) <T> RuntimeValue<T>
newInstance
(String name) Creates a RuntimeValue object that represents an object created via the default constructor.<T> void
registerConstant
(Class<T> type, T value) <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<? super F, ? super T>> substitution) Registers a substitution to allow objects that are not serializable to bytecode to be substituted for an object that is.void
writeBytecode
(io.quarkus.gizmo.ClassOutput classOutput)
-
Field Details
-
CREATE_ARRAY
- See Also:
-
-
Constructor Details
-
BytecodeRecorderImpl
-
BytecodeRecorderImpl
-
BytecodeRecorderImpl
BytecodeRecorderImpl(ClassLoader classLoader, boolean staticInit, String className)
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
registerSubstitution
public <F,T> void registerSubstitution(Class<F> from, Class<T> to, Class<? extends ObjectSubstitution<? super F, ? super T>> substitution) Description copied from interface:RecorderContext
Registers a substitution to allow objects that are not serializable to bytecode to be substituted for an object that is.- Specified by:
registerSubstitution
in interfaceRecorderContext
- Parameters:
from
- The class of the non-serializable objectto
- The class to serialize tosubstitution
- The subclass ofObjectSubstitution
that performs the substitution
-
registerNonDefaultConstructor
public <T> void registerNonDefaultConstructor(Constructor<T> constructor, Function<T, List<Object>> parameters) Description copied from interface:RecorderContext
Registers a way to construct an object via a non-default constructor. Each object may only have at most one non-default constructor registered- Specified by:
registerNonDefaultConstructor
in interfaceRecorderContext
- Type Parameters:
T
- The type of the object- Parameters:
constructor
- The constructorparameters
- A function that maps the object to a list of constructor parameters
-
registerObjectLoader
Description copied from interface:RecorderContext
Register an object loader.- Specified by:
registerObjectLoader
in interfaceRecorderContext
- Parameters:
loader
- the object loader (must not benull
)
-
registerConstant
-
classProxy
Description copied from interface:RecorderContext
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. At runtime the actual class will be passed into the invoked method.- Specified by:
classProxy
in interfaceRecorderContext
- Parameters:
name
- The fully-qualified class name- Returns:
- A Class instance that can be passed to a recording proxy
-
newInstance
Description copied from interface:RecorderContext
Creates a RuntimeValue object that represents an object created via the default constructor.This object can be passed into recorders, but must not be used directly at deployment time
- Specified by:
newInstance
in interfaceRecorderContext
- Type Parameters:
T
- The type of the class- Parameters:
name
- The name of the class- Returns:
- The class instance proxy
-
getRecordingProxy
-
markClassAsConstructorRecordable
-
getClassName
-
writeBytecode
public void writeBytecode(io.quarkus.gizmo.ClassOutput classOutput) -
loadValue
BytecodeRecorderImpl.DeferredParameter loadValue(org.jboss.jandex.AnnotationValue value, org.jboss.jandex.ClassInfo annotationClass, org.jboss.jandex.MethodInfo method) -
arrayValue
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) -
componentType
-