Record Class MethodDescription
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.definitions.description.MethodDescription
- Record Components:
declaringClass- the declaringClassof this methodreturnType- theClassthis method returnsname- the name of the methodmodifiers- the Java language modifiers of this methodparameters- aSequencedCollectionof theParameterDescriptions of this methodannotations- aCollectionof allAnnotations this method is annotated withinvoker- the correspondingInvoker, used to invoke this method
- All Implemented Interfaces:
Description
public record MethodDescription(Class<?> declaringClass, Class<?> returnType, Type genericReturnType, String name, int modifiers, SequencedCollection<ParameterDescription> parameters, Collection<AnnotationDescription<?>> annotations, Invoker invoker)
extends Record
implements Description
A
Description that describes a method.-
Constructor Summary
ConstructorsConstructorDescriptionMethodDescription(Class<?> declaringClass, Class<?> returnType, Type genericReturnType, String name, int modifiers, SequencedCollection<ParameterDescription> parameters, Collection<AnnotationDescription<?>> annotations, Invoker invoker) Creates an instance of aMethodDescriptionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theannotationsrecord component.Class<?> Returns the value of thedeclaringClassrecord component.final booleanIndicates whether some other object is "equal to" this one.findParameter(String name) Gets the parameter matching the given name if any.Returns the value of thegenericReturnTyperecord component.final inthashCode()Returns a hash code value for this object.invoker()Returns the value of theinvokerrecord component.intReturns the value of themodifiersrecord component.name()Returns the value of thenamerecord component.Gets the parameter matching the given name.Returns the value of theparametersrecord component.Class<?> Returns the value of thereturnTyperecord component.toString()Returns a string representation of this record class.Methods inherited from interface Description
annotation, findAnnotation, hasAnnotation
-
Constructor Details
-
MethodDescription
public MethodDescription(Class<?> declaringClass, Class<?> returnType, Type genericReturnType, String name, int modifiers, SequencedCollection<ParameterDescription> parameters, Collection<AnnotationDescription<?>> annotations, Invoker invoker) Creates an instance of aMethodDescriptionrecord class.- Parameters:
declaringClass- the value for thedeclaringClassrecord componentreturnType- the value for thereturnTyperecord componentgenericReturnType- the value for thegenericReturnTyperecord componentname- the value for thenamerecord componentmodifiers- the value for themodifiersrecord componentparameters- the value for theparametersrecord componentannotations- the value for theannotationsrecord componentinvoker- the value for theinvokerrecord component
-
-
Method Details
-
findParameter
Gets the parameter matching the given name if any.
Please note that if
-parametersisn't present on the 'javac' command, this is justarg0,arg1etc. if usingDescriptor.REFLECTIVE.- Parameters:
name- the parameters name- Returns:
- the matching
ParameterDescriptionorOptional.empty()
-
parameter
Gets the parameter matching the given name. Throws if no matching parameter is found.
Please note that if
-parametersisn't present on the 'javac' command, this is justarg0,arg1etc. if usingDescriptor.REFLECTIVE.- Parameters:
name- the parameters name- Returns:
- the matching
ParameterDescription - Throws:
NoSuchElementException- if no element was found- See Also:
-
toMethodType
- Returns:
- the return type and parameters of this method as a
MethodType
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
declaringClass
Returns the value of thedeclaringClassrecord component.- Returns:
- the value of the
declaringClassrecord component
-
returnType
Returns the value of thereturnTyperecord component.- Returns:
- the value of the
returnTyperecord component
-
genericReturnType
Returns the value of thegenericReturnTyperecord component.- Returns:
- the value of the
genericReturnTyperecord component
-
name
-
modifiers
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-
annotations
Returns the value of theannotationsrecord component.- Specified by:
annotationsin interfaceDescription- Returns:
- the value of the
annotationsrecord component
-
invoker
-