Class JavassistEnumDeclaration
- java.lang.Object
-
- com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
-
- com.github.javaparser.symbolsolver.javassistmodel.JavassistEnumDeclaration
-
- All Implemented Interfaces:
AssociableToAST
,HasAccessSpecifier
,ResolvedDeclaration
,ResolvedEnumDeclaration
,ResolvedReferenceTypeDeclaration
,ResolvedTypeDeclaration
,ResolvedTypeParametrizable
,MethodResolutionCapability
,MethodUsageResolutionCapability
,SymbolResolutionCapability
public class JavassistEnumDeclaration extends AbstractTypeDeclaration implements ResolvedEnumDeclaration, MethodResolutionCapability, MethodUsageResolutionCapability, SymbolResolutionCapability
- Author:
- Federico Tomassetti
-
-
Field Summary
-
Fields inherited from interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
breadthFirstFunc, depthFirstFunc, JAVA_LANG_ENUM, JAVA_LANG_OBJECT
-
-
Constructor Summary
Constructors Constructor Description JavassistEnumDeclaration(javassist.CtClass ctClass, TypeSolver typeSolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessSpecifier
accessSpecifier()
The access specifier of this element.Optional<ResolvedReferenceTypeDeclaration>
containerType()
Get the ReferenceTypeDeclaration enclosing this declaration.List<ResolvedFieldDeclaration>
getAllFields()
Return a list of all fields, either declared in this declaration or inherited.List<ResolvedReferenceType>
getAncestors(boolean acceptIncompleteList)
Resolves the types of all direct ancestors (i.e., the directly extended class and the directly implemented interfaces) and returns the list of ancestors as a list of resolved reference types.String
getClassName()
The class(es) wrapping this type.List<ResolvedConstructorDeclaration>
getConstructors()
Set<ResolvedMethodDeclaration>
getDeclaredMethods()
Return a list of all the methods declared in this type declaration.List<ResolvedEnumConstantDeclaration>
getEnumConstants()
ResolvedFieldDeclaration
getField(String name)
Note that the type of the field should be expressed using the type variables of this particular type.ResolvedReferenceTypeDeclaration
getInternalType(String name)
Returns a type declaration for the internal type based on name.String
getName()
Should return the name or return null if the name is not available.String
getPackageName()
The package name of the type.String
getQualifiedName()
The fully qualified name of the type declared.List<ResolvedTypeParameterDeclaration>
getTypeParameters()
The list of type parameters defined on this element.boolean
hasDirectlyAnnotation(String canonicalName)
Has the type at least one annotation declared having the specified qualified name?boolean
hasField(String name)
Has this type a field with the given name?boolean
hasInternalType(String name)
Does this type contain an internal type with the given name? (Does not include internal types inside internal types).Set<ResolvedReferenceTypeDeclaration>
internalTypes()
Get the list of types defined inside the current type.boolean
isAssignableBy(ResolvedReferenceTypeDeclaration other)
Can we assign instances of the given type to variables having the type defined by this declaration?boolean
isAssignableBy(ResolvedType type)
Can we assign instances of the given type to variables having the type defined by this declaration?SymbolReference<ResolvedMethodDeclaration>
solveMethod(String name, List<ResolvedType> argumentsTypes, boolean staticOnly)
Optional<MethodUsage>
solveMethodAsUsage(String name, List<ResolvedType> argumentsTypes, Context invokationContext, List<ResolvedType> typeParameterValues)
SymbolReference<? extends ResolvedValueDeclaration>
solveSymbol(String name, TypeSolver typeSolver)
String
toString()
-
Methods inherited from class com.github.javaparser.symbolsolver.logic.AbstractTypeDeclaration
getAllMethods, isFunctionalInterface
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.resolution.declarations.AssociableToAST
toAst, toAst
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asPattern, hasName, isEnumConstant, isField, isMethod, isParameter, isPattern, isVariable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedEnumDeclaration
asEnum, getEnumConstant, hasEnumConstant, isEnum
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration
asReferenceType, canBeAssignedTo, findTypeParameter, getAllAncestors, getAllAncestors, getAllMethods, getAllNonStaticFields, getAllStaticFields, getAncestors, getDeclaredFields, getVisibleField, getVisibleFields, hasAnnotation, hasVisibleField, isFunctionalInterface, isJavaLangEnum, isJavaLangObject, isReferenceType
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration
asAnnotation, asClass, asInterface, asType, asTypeParameter, getId, isAnnotation, isAnonymousClass, isClass, isInterface, isType, isTypeParameter
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable
isGeneric
-
-
-
-
Constructor Detail
-
JavassistEnumDeclaration
public JavassistEnumDeclaration(javassist.CtClass ctClass, TypeSolver typeSolver)
-
-
Method Detail
-
accessSpecifier
public AccessSpecifier accessSpecifier()
Description copied from interface:HasAccessSpecifier
The access specifier of this element.- Specified by:
accessSpecifier
in interfaceHasAccessSpecifier
-
getPackageName
public String getPackageName()
Description copied from interface:ResolvedTypeDeclaration
The package name of the type.- Specified by:
getPackageName
in interfaceResolvedTypeDeclaration
-
getClassName
public String getClassName()
Description copied from interface:ResolvedTypeDeclaration
The class(es) wrapping this type.- Specified by:
getClassName
in interfaceResolvedTypeDeclaration
-
getQualifiedName
public String getQualifiedName()
Description copied from interface:ResolvedTypeDeclaration
The fully qualified name of the type declared.- Specified by:
getQualifiedName
in interfaceResolvedTypeDeclaration
-
getAncestors
public List<ResolvedReferenceType> getAncestors(boolean acceptIncompleteList)
Description copied from interface:ResolvedReferenceTypeDeclaration
Resolves the types of all direct ancestors (i.e., the directly extended class and the directly implemented interfaces) and returns the list of ancestors as a list of resolved reference types.If
acceptIncompleteList
isfalse
, then anUnsolvedSymbolException
is thrown if any ancestor cannot be resolved. Otherwise, a list of only the resolvable direct ancestors is returned.- Specified by:
getAncestors
in interfaceResolvedReferenceTypeDeclaration
- Parameters:
acceptIncompleteList
- When set tofalse
, this method throws anUnsolvedSymbolException
if one or more ancestor could not be resolved. When set totrue
, this method does not throw anUnsolvedSymbolException
, but the list of returned ancestors may be incomplete in case one or more ancestor could not be resolved.- Returns:
- The list of resolved ancestors.
-
getField
public ResolvedFieldDeclaration getField(String name)
Description copied from interface:ResolvedReferenceTypeDeclaration
Note that the type of the field should be expressed using the type variables of this particular type. Consider for example:class Foo
{ E field; } class Bar extends Foo
{ } When calling getField("field") on Foo I should get a FieldDeclaration with type E, while calling it on Bar I should get a FieldDeclaration with type String.
- Specified by:
getField
in interfaceResolvedReferenceTypeDeclaration
-
hasField
public boolean hasField(String name)
Description copied from interface:ResolvedReferenceTypeDeclaration
Has this type a field with the given name?- Specified by:
hasField
in interfaceResolvedReferenceTypeDeclaration
-
getAllFields
public List<ResolvedFieldDeclaration> getAllFields()
Description copied from interface:ResolvedReferenceTypeDeclaration
Return a list of all fields, either declared in this declaration or inherited.- Specified by:
getAllFields
in interfaceResolvedReferenceTypeDeclaration
-
getDeclaredMethods
public Set<ResolvedMethodDeclaration> getDeclaredMethods()
Description copied from interface:ResolvedReferenceTypeDeclaration
Return a list of all the methods declared in this type declaration.- Specified by:
getDeclaredMethods
in interfaceResolvedReferenceTypeDeclaration
-
isAssignableBy
public boolean isAssignableBy(ResolvedType type)
Description copied from interface:ResolvedReferenceTypeDeclaration
Can we assign instances of the given type to variables having the type defined by this declaration?- Specified by:
isAssignableBy
in interfaceResolvedReferenceTypeDeclaration
-
isAssignableBy
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other)
Description copied from interface:ResolvedReferenceTypeDeclaration
Can we assign instances of the given type to variables having the type defined by this declaration?- Specified by:
isAssignableBy
in interfaceResolvedReferenceTypeDeclaration
-
hasDirectlyAnnotation
public boolean hasDirectlyAnnotation(String canonicalName)
Description copied from interface:ResolvedReferenceTypeDeclaration
Has the type at least one annotation declared having the specified qualified name?- Specified by:
hasDirectlyAnnotation
in interfaceResolvedReferenceTypeDeclaration
-
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
-
containerType
public Optional<ResolvedReferenceTypeDeclaration> containerType()
Description copied from interface:ResolvedTypeDeclaration
Get the ReferenceTypeDeclaration enclosing this declaration.- Specified by:
containerType
in interfaceResolvedTypeDeclaration
-
solveMethod
public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> argumentsTypes, boolean staticOnly)
- Specified by:
solveMethod
in interfaceMethodResolutionCapability
-
solveMethodAsUsage
public Optional<MethodUsage> solveMethodAsUsage(String name, List<ResolvedType> argumentsTypes, Context invokationContext, List<ResolvedType> typeParameterValues)
- Specified by:
solveMethodAsUsage
in interfaceMethodUsageResolutionCapability
-
internalTypes
public Set<ResolvedReferenceTypeDeclaration> internalTypes()
Description copied from interface:ResolvedTypeDeclaration
Get the list of types defined inside the current type.- Specified by:
internalTypes
in interfaceResolvedTypeDeclaration
-
getInternalType
public ResolvedReferenceTypeDeclaration getInternalType(String name)
Description copied from interface:ResolvedTypeDeclaration
Returns a type declaration for the internal type based on name. (Does not include internal types inside internal types).- Specified by:
getInternalType
in interfaceResolvedTypeDeclaration
-
hasInternalType
public boolean hasInternalType(String name)
Description copied from interface:ResolvedTypeDeclaration
Does this type contain an internal type with the given name? (Does not include internal types inside internal types).- Specified by:
hasInternalType
in interfaceResolvedTypeDeclaration
-
solveSymbol
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name, TypeSolver typeSolver)
- Specified by:
solveSymbol
in interfaceSymbolResolutionCapability
- Parameters:
name
- Field / symbol name.typeSolver
- Symbol solver to resolve type usage.- Returns:
- Symbol reference of the resolved value.
-
getEnumConstants
public List<ResolvedEnumConstantDeclaration> getEnumConstants()
- Specified by:
getEnumConstants
in interfaceResolvedEnumDeclaration
-
getConstructors
public List<ResolvedConstructorDeclaration> getConstructors()
- Specified by:
getConstructors
in interfaceResolvedReferenceTypeDeclaration
-
-