Preview
Second Preview of ClassFile API (JEP 466).
Programs can only use MethodBuilder
when preview features are enabled.
Preview features may be removed in a future release,
or upgraded to permanent features of the Java platform.
ClassBuilder#withMethod(Utf8Entry, Utf8Entry, int, Consumer)
or to method transforms. The elements of a method can be specified
abstractly (by passing a MethodElement
to with(ClassFileElement)
or concretely by calling the various withXxx
methods.
MethodTransform
Modifier and Type | Method and Description |
---|---|
public Optional | Returns: theMethodModel representing the method being transformed,
if this method builder represents the transformation of some MethodModel Returns the |
public MethodBuilder | Returns: this builderthe method body to be transformed code, CodeTransform the transform to apply to the method body transform)Build the method body for this method by transforming the body of another method. |
public MethodBuilder | Returns: this buildera handler receiving a code)CodeBuilder Build the method body for this method. |
public default MethodBuilder | Returns: this builderthe access flags, as a bit mask flags)Sets the method access flags. |
public default MethodBuilder | Returns: this builderthe access flags, as a bit mask flags)Sets the method access flags. |
original | back to summary |
---|---|
public Optional Returns the
|
transformCode | back to summary |
---|---|
public MethodBuilder transformCode(CodeModel code, CodeTransform transform) Build the method body for this method by transforming the body of another method. Implementation Note This method behaves as if: withCode(b -> b.transformCode(code, transform));
|
withCode | back to summary |
---|---|
public MethodBuilder withCode(Consumer<? super CodeBuilder> code) Build the method body for this method.
|
withFlags | back to summary |
---|---|
public default MethodBuilder withFlags(int flags) Sets the method access flags.
|
withFlags | back to summary |
---|---|
public default MethodBuilder withFlags(AccessFlag... flags) Sets the method access flags.
|