Package io.quarkus.gizmo
Class MethodCreatorImpl
- java.lang.Object
-
- io.quarkus.gizmo.BytecodeCreatorImpl
-
- io.quarkus.gizmo.MethodCreatorImpl
-
- All Implemented Interfaces:
AnnotatedElement,BytecodeCreator,MemberCreator<MethodCreator>,MethodCreator,SignatureElement<MethodCreator>,java.lang.AutoCloseable
- Direct Known Subclasses:
ClassTransfromerMethodCreatorImpl
class MethodCreatorImpl extends BytecodeCreatorImpl implements MethodCreator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classMethodCreatorImpl.AnnotationParameters-
Nested classes/interfaces inherited from class io.quarkus.gizmo.BytecodeCreatorImpl
BytecodeCreatorImpl.AssignOperation, BytecodeCreatorImpl.BlockOperation, BytecodeCreatorImpl.IfOperation, BytecodeCreatorImpl.InvokeOperation, BytecodeCreatorImpl.JumpOperation, BytecodeCreatorImpl.NewInstanceOperation, BytecodeCreatorImpl.Operation
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<AnnotationCreatorImpl>annotationsprivate ClassCreatorclassCreatorprivate java.lang.StringdeclaringClassNameprivate java.util.List<java.lang.String>exceptionsprivate MethodDescriptormethodDescriptorprivate intmodifiersprivate java.util.Map<java.lang.Integer,MethodCreatorImpl.AnnotationParameters>parameterAnnotationsprivate java.lang.String[]parameterNamesprivate java.lang.Stringsignature-
Fields inherited from class io.quarkus.gizmo.BytecodeCreatorImpl
MAX_STRING_LENGTH, operations
-
-
Constructor Summary
Constructors Constructor Description MethodCreatorImpl(BytecodeCreatorImpl enclosing, MethodDescriptor methodDescriptor, java.lang.String declaringClassName, ClassCreator classCreator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotationCreatoraddAnnotation(java.lang.String annotationType, java.lang.annotation.RetentionPolicy retentionPolicy)MethodCreatoraddException(java.lang.String exception)Adds an exception to the method signature(package private) FunctionCreatorImpladdFunctionBody(ResultHandle instance, ClassCreator cc, MethodCreatorImpl mc, BytecodeCreatorImpl owner)(package private) ClassCreatorgetClassCreator()(package private) ClassOutputgetClassOutput()(package private) java.lang.StringgetDeclaringClassName()java.util.List<java.lang.String>getExceptions()MethodDescriptorgetMethodDescriptor()intgetModifiers()AnnotatedElementgetParameterAnnotations(int param)java.lang.StringgetSignature()(package private) ResultHandle[]resolve(BytecodeCreator owner, ResultHandle... handles)(package private) ResultHandleresolve(ResultHandle handle, BytecodeCreator creator)MethodCreatorsetModifiers(int mods)voidsetParameterNames(java.lang.String[] parameterNames)Sets names of all this method's parameters.MethodCreatorsetSignature(java.lang.String signature)Use the convenientSignatureBuilderto build signatures for classes, methods and fields.java.lang.StringtoString()voidwrite(org.objectweb.asm.ClassVisitor file)-
Methods inherited from class io.quarkus.gizmo.BytecodeCreatorImpl
add, allocateLocalVariables, arrayLength, assign, bitwiseAnd, bitwiseOr, bitwiseXor, breakScope, checkCast, checkScope, checkScope, compareDouble, compareFloat, compareLong, continueScope, convertPrimitive, createFunction, createNewInstanceOp, createScope, createVariable, divide, enumSwitch, findActiveResultHandles, forEach, getBottom, getMethod, getMethodParam, getOwner, getThis, getTop, ifFalse, ifGreaterEqualZero, ifGreaterThanZero, ifIntegerEqual, ifIntegerGreaterEqual, ifIntegerGreaterThan, ifIntegerLessEqual, ifIntegerLessThan, ifLessEqualZero, ifLessThanZero, ifNonZero, ifNotNull, ifNull, ifReferencesEqual, ifReferencesNotEqual, ifThenElse, ifTrue, ifZero, instanceOf, invokeInterfaceMethod, invokeSpecialInterfaceMethod, invokeSpecialMethod, invokeStaticInterfaceMethod, invokeStaticMethod, invokeVirtualMethod, isScopedWithin, jumpTo, load, load, load, load, load, load, load, load, load, loadClass, loadClassFromTCCL, loadNull, loadResultHandle, loadResultHandle, multiply, newArray, newInstance, readArrayValue, readInstanceField, readStaticField, remainder, resolve, resolve, returnValue, storeResultHandle, stringSwitch, subtract, throwException, tryBlock, whileLoop, writeArrayValue, writeInstanceField, writeInteriorOperations, writeOperations, writeStaticField
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.quarkus.gizmo.AnnotatedElement
addAnnotation, addAnnotation, addAnnotation
-
Methods inherited from interface io.quarkus.gizmo.BytecodeCreator
add, arrayLength, assign, bitwiseAnd, bitwiseOr, bitwiseXor, breakScope, breakScope, checkCast, checkCast, close, compareDouble, compareFloat, compareLong, continueScope, continueScope, convertPrimitive, createFunction, createScope, createVariable, createVariable, divide, enumSwitch, forEach, getMethodParam, getThis, ifFalse, ifGreaterEqualZero, ifGreaterThanZero, ifIntegerEqual, ifIntegerGreaterEqual, ifIntegerGreaterThan, ifIntegerLessEqual, ifIntegerLessThan, ifLessEqualZero, ifLessThanZero, ifNonZero, ifNotNull, ifNull, ifReferencesEqual, ifReferencesNotEqual, ifThenElse, ifTrue, ifZero, increment, instanceOf, instanceOf, invokeInterfaceMethod, invokeInterfaceMethod, invokeSpecialInterfaceMethod, invokeSpecialInterfaceMethod, invokeSpecialMethod, invokeSpecialMethod, invokeStaticInterfaceMethod, invokeStaticInterfaceMethod, invokeStaticMethod, invokeStaticMethod, invokeVirtualMethod, invokeVirtualMethod, isScopedWithin, load, load, load, load, load, load, load, load, load, load, loadClass, loadClass, loadClass, loadClassFromTCCL, loadClassFromTCCL, loadClassFromTCCL, loadNull, marshalAsArray, multiply, newArray, newArray, newArray, newArray, newInstance, newInstance, readArrayValue, readArrayValue, readInstanceField, readInstanceField, readStaticField, readStaticField, remainder, returnBoolean, returnInt, returnNull, returnValue, returnVoid, stringSwitch, subtract, throwException, throwException, throwException, tryBlock, whileLoop, writeArrayValue, writeArrayValue, writeInstanceField, writeInstanceField, writeStaticField, writeStaticField
-
Methods inherited from interface io.quarkus.gizmo.MethodCreator
addException
-
-
-
-
Field Detail
-
exceptions
private final java.util.List<java.lang.String> exceptions
-
annotations
private final java.util.List<AnnotationCreatorImpl> annotations
-
parameterAnnotations
private final java.util.Map<java.lang.Integer,MethodCreatorImpl.AnnotationParameters> parameterAnnotations
-
methodDescriptor
private final MethodDescriptor methodDescriptor
-
declaringClassName
private final java.lang.String declaringClassName
-
classCreator
private final ClassCreator classCreator
-
signature
private java.lang.String signature
-
modifiers
private int modifiers
-
parameterNames
private java.lang.String[] parameterNames
-
-
Constructor Detail
-
MethodCreatorImpl
MethodCreatorImpl(BytecodeCreatorImpl enclosing, MethodDescriptor methodDescriptor, java.lang.String declaringClassName, ClassCreator classCreator)
-
-
Method Detail
-
addException
public MethodCreator addException(java.lang.String exception)
Description copied from interface:MethodCreatorAdds an exception to the method signature- Specified by:
addExceptionin interfaceMethodCreator- Parameters:
exception- The exception- Returns:
- This creator
-
getExceptions
public java.util.List<java.lang.String> getExceptions()
- Specified by:
getExceptionsin interfaceMethodCreator- Returns:
- The exceptions thrown by this method
-
getMethodDescriptor
public MethodDescriptor getMethodDescriptor()
- Specified by:
getMethodDescriptorin interfaceMethodCreator- Returns:
- The method descriptor
-
getParameterAnnotations
public AnnotatedElement getParameterAnnotations(int param)
- Specified by:
getParameterAnnotationsin interfaceMethodCreator
-
setParameterNames
public void setParameterNames(java.lang.String[] parameterNames)
Description copied from interface:MethodCreatorSets names of all this method's parameters. The length ofparameterNamesmust be equal to the number of this method's parameters. Removes previously set parameter names ifparameterNamesisnull.It is required to set all parameter names in one go, because parameter names are stored in bytecode as a simple sequence, without positions.
When generating a method with mandated or synthetic parameters (such as an inner class constructor), remember that these parameters must have names too.
- Specified by:
setParameterNamesin interfaceMethodCreator- Parameters:
parameterNames- names of all parameters of this method
-
getModifiers
public int getModifiers()
- Specified by:
getModifiersin interfaceMemberCreator<MethodCreator>
-
setModifiers
public MethodCreator setModifiers(int mods)
- Specified by:
setModifiersin interfaceMemberCreator<MethodCreator>
-
write
public void write(org.objectweb.asm.ClassVisitor file)
- Specified by:
writein interfaceMemberCreator<MethodCreator>
-
resolve
ResultHandle resolve(ResultHandle handle, BytecodeCreator creator)
- Overrides:
resolvein classBytecodeCreatorImpl
-
resolve
ResultHandle[] resolve(BytecodeCreator owner, ResultHandle... handles)
- Overrides:
resolvein classBytecodeCreatorImpl
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
addAnnotation
public AnnotationCreator addAnnotation(java.lang.String annotationType, java.lang.annotation.RetentionPolicy retentionPolicy)
- Specified by:
addAnnotationin interfaceAnnotatedElement
-
getDeclaringClassName
java.lang.String getDeclaringClassName()
-
getClassOutput
ClassOutput getClassOutput()
-
getClassCreator
ClassCreator getClassCreator()
-
addFunctionBody
FunctionCreatorImpl addFunctionBody(ResultHandle instance, ClassCreator cc, MethodCreatorImpl mc, BytecodeCreatorImpl owner)
-
getSignature
public java.lang.String getSignature()
- Specified by:
getSignaturein interfaceSignatureElement<MethodCreator>
-
setSignature
public MethodCreator setSignature(java.lang.String signature)
Description copied from interface:SignatureElementUse the convenientSignatureBuilderto build signatures for classes, methods and fields.- Specified by:
setSignaturein interfaceSignatureElement<MethodCreator>- Parameters:
signature- The generic signature as defined in JVMS 17, chapter "4.7.9.1. Signatures"- Returns:
- the element
- See Also:
SignatureBuilder
-
-