Class JavaParserEnumDeclaration.ValueOfMethod
- java.lang.Object
-
- com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserEnumDeclaration.ValueOfMethod
-
- All Implemented Interfaces:
AssociableToAST
,HasAccessSpecifier
,ResolvedDeclaration
,ResolvedMethodDeclaration
,ResolvedMethodLikeDeclaration
,ResolvedTypeParametrizable
,TypeVariableResolutionCapability
- Enclosing class:
- JavaParserEnumDeclaration
public static class JavaParserEnumDeclaration.ValueOfMethod extends Object implements ResolvedMethodDeclaration, TypeVariableResolutionCapability
Needed by ContextHelper An implicitly declared methodpublic static E valueOf(String name)
, which returns the enum constant ofE
with the specified name.
-
-
Constructor Summary
Constructors Constructor Description ValueOfMethod(JavaParserEnumDeclaration enumDeclaration, TypeSolver typeSolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessSpecifier
accessSpecifier()
The access specifier of this element.ResolvedReferenceTypeDeclaration
declaringType()
The type in which the method is declared.String
getName()
Should return the name or return null if the name is not available.int
getNumberOfParams()
Number of params.int
getNumberOfSpecifiedExceptions()
Number of exceptions listed in the throws clause.ResolvedParameterDeclaration
getParam(int i)
Get the ParameterDeclaration at the corresponding position or throw IllegalArgumentException.ResolvedType
getReturnType()
The type of the value returned by the current method.ResolvedType
getSpecifiedException(int index)
Type of the corresponding entry in the throws clause.List<ResolvedTypeParameterDeclaration>
getTypeParameters()
The list of type parameters defined on this element.MethodUsage
getUsage(Node node)
boolean
isAbstract()
Is the method abstract? All interface methods not marked as default are abstract.boolean
isDefaultMethod()
Is this a default method?boolean
isStatic()
MethodUsage
resolveTypeVariables(Context context, List<ResolvedType> parameterTypes)
Optional<Node>
toAst()
If the declaration is associated to an AST node return it, otherwise it return empty.String
toDescriptor()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.resolution.declarations.AssociableToAST
toAst
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asPattern, asType, hasName, isEnumConstant, isField, isMethod, isParameter, isPattern, isType, isVariable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration
isReturnTypeSubstituable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedMethodLikeDeclaration
findTypeParameter, formalParameterTypes, getClassName, getLastParam, getPackageName, getQualifiedName, getQualifiedSignature, getSignature, getSpecifiedExceptions, hasVariadicParameter
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable
isGeneric
-
-
-
-
Constructor Detail
-
ValueOfMethod
public ValueOfMethod(JavaParserEnumDeclaration enumDeclaration, TypeSolver typeSolver)
-
-
Method Detail
-
declaringType
public ResolvedReferenceTypeDeclaration declaringType()
Description copied from interface:ResolvedMethodLikeDeclaration
The type in which the method is declared.- Specified by:
declaringType
in interfaceResolvedMethodLikeDeclaration
-
getReturnType
public ResolvedType getReturnType()
Description copied from interface:ResolvedMethodDeclaration
The type of the value returned by the current method. This method can also be invoked for methods returning void.- Specified by:
getReturnType
in interfaceResolvedMethodDeclaration
-
getNumberOfParams
public int getNumberOfParams()
Description copied from interface:ResolvedMethodLikeDeclaration
Number of params.- Specified by:
getNumberOfParams
in interfaceResolvedMethodLikeDeclaration
-
getParam
public ResolvedParameterDeclaration getParam(int i)
Description copied from interface:ResolvedMethodLikeDeclaration
Get the ParameterDeclaration at the corresponding position or throw IllegalArgumentException.- Specified by:
getParam
in interfaceResolvedMethodLikeDeclaration
-
getUsage
public MethodUsage getUsage(Node node)
-
resolveTypeVariables
public MethodUsage resolveTypeVariables(Context context, List<ResolvedType> parameterTypes)
- Specified by:
resolveTypeVariables
in interfaceTypeVariableResolutionCapability
-
isAbstract
public boolean isAbstract()
Description copied from interface:ResolvedMethodDeclaration
Is the method abstract? All interface methods not marked as default are abstract.- Specified by:
isAbstract
in interfaceResolvedMethodDeclaration
-
isDefaultMethod
public boolean isDefaultMethod()
Description copied from interface:ResolvedMethodDeclaration
Is this a default method?- Specified by:
isDefaultMethod
in interfaceResolvedMethodDeclaration
-
isStatic
public boolean isStatic()
- Specified by:
isStatic
in interfaceResolvedMethodDeclaration
-
getName
public String getName()
Description copied from interface:ResolvedDeclaration
Should return the name or return null if the name is not available.- Specified by:
getName
in interfaceResolvedDeclaration
-
getTypeParameters
public List<ResolvedTypeParameterDeclaration> getTypeParameters()
Description copied from interface:ResolvedTypeParametrizable
The list of type parameters defined on this element.- Specified by:
getTypeParameters
in interfaceResolvedTypeParametrizable
-
accessSpecifier
public AccessSpecifier accessSpecifier()
Description copied from interface:HasAccessSpecifier
The access specifier of this element.- Specified by:
accessSpecifier
in interfaceHasAccessSpecifier
-
getNumberOfSpecifiedExceptions
public int getNumberOfSpecifiedExceptions()
Description copied from interface:ResolvedMethodLikeDeclaration
Number of exceptions listed in the throws clause.- Specified by:
getNumberOfSpecifiedExceptions
in interfaceResolvedMethodLikeDeclaration
-
getSpecifiedException
public ResolvedType getSpecifiedException(int index)
Description copied from interface:ResolvedMethodLikeDeclaration
Type of the corresponding entry in the throws clause.- Specified by:
getSpecifiedException
in interfaceResolvedMethodLikeDeclaration
-
toAst
public Optional<Node> toAst()
Description copied from interface:AssociableToAST
If the declaration is associated to an AST node return it, otherwise it return empty. Declaration based on source code have an AST node associated while others don't. Example of other declarations are declarations coming from reflection or JARs. You may wonder how this method is different from the various getWrappedNode. The difference is that toAst is present in all Resolved* declarations (such as ResolvedAnnotationDeclaration), while getWrappedNode is present only on the subclasses of the Resolved* declarations that derive from JP AST nodes (such as JavaParserClassDeclaration). Therefore one which has a Resolved* declaration need to do a downcast before being able to use getWrappedNode. Now, this means that toAst could potentially replace getWrappedNode (but not the other way around!). However toAst return an Optional, which is less convenient than getting the direct node. Also, toAst sometimes have to return a more generic node. This is the case for subclasses of ResolvedClassDeclaration. In those cases toAst return a Node. Why? Because both anonymous class declarations and standard class declarations are subclasses of that. In one case the underlying AST node is an ObjectCreationExpr, while in the other case it is ClassOrInterfaceDeclaration. In these cases getWrappedNode is particularly nice because it returns the right type of AST node, not just a Node.- Specified by:
toAst
in interfaceAssociableToAST
-
toDescriptor
public String toDescriptor()
- Specified by:
toDescriptor
in interfaceResolvedMethodDeclaration
-
-