Top Description Fields Constructors Methods
org.springframework.aot.generate

public final Class GeneratedMethod

extends Object
Class Inheritance
Imports
java.util.function.Consumer, org.springframework.javapoet.ClassName, .MethodSpec, org.springframework.util.Assert

A generated method.
Authors
Phillip Webb, Stephane Nicoll
Since
6.0
See Also
GeneratedMethods

Field Summary

Modifier and TypeField and Description
private final ClassName
private final MethodSpec
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
GeneratedMethod(ClassName
the declaring class of the method
className
,
String
the generated method name
name
,
Consumer<MethodSpec.Builder>
consumer to generate the method
method
)

Create a new GeneratedMethod instance with the given name.

Method Summary

Modifier and TypeMethod and Description
pack-priv MethodSpec

Returns:

the method spec
getMethodSpec
()

Return the MethodSpec for this generated method.

public String

Returns:

the name of the generated method
getName
()

Return the generated name of the method.

public MethodReference

Returns:

a method reference
toMethodReference
()

Return a MethodReference to this generated method.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

classNameback to summary
private final ClassName className
methodSpecback to summary
private final MethodSpec methodSpec
nameback to summary
private final String name

Constructor Detail

GeneratedMethodback to summary
pack-priv GeneratedMethod(ClassName className, String name, Consumer<MethodSpec.Builder> method)

Create a new GeneratedMethod instance with the given name. This constructor is package-private since names should only be generated via GeneratedMethods.

Parameters
className:ClassName

the declaring class of the method

name:String

the generated method name

method:Consumer<MethodSpec.Builder>

consumer to generate the method

Method Detail

getMethodSpecback to summary
pack-priv MethodSpec getMethodSpec()

Return the MethodSpec for this generated method.

Returns:MethodSpec

the method spec

Exceptions
IllegalStateException:
if one of the generateBy(...) methods has not been called
getNameback to summary
public String getName()

Return the generated name of the method.

Returns:String

the name of the generated method

toMethodReferenceback to summary
public MethodReference toMethodReference()

Return a MethodReference to this generated method.

Returns:MethodReference

a method reference

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override