Class Java.AbstractTypeDeclaration
java.lang.Object
org.codehaus.janino.Java.AbstractTypeDeclaration
- All Implemented Interfaces:
Java.Annotatable, Java.Locatable, Java.Scope, Java.TypeDeclaration
- Direct Known Subclasses:
Java.AbstractClassDeclaration, Java.InterfaceDeclaration
- Enclosing class:
Java
public abstract static class Java.AbstractTypeDeclaration
extends Object
implements Java.TypeDeclaration
Abstract implementation of
Java.TypeDeclaration.-
Field Summary
FieldsModifier and TypeFieldDescriptionintFor naming anonymous classes.private final List<Java.MemberTypeDeclaration> private final List<Java.MethodDeclarator> private Java.ScopeintFor naming local classes.private final Locationprivate final Java.Modifier[](package private) IClassHolds the resolved type during compilation.private final Java.TypeParameter[] -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTypeDeclaration(Location location, Java.Modifier[] modifiers, Java.TypeParameter[] typeParameters) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds oneJava.MethodDeclaratorto this type.voidAdds oneJava.MemberTypeDeclarationto this type.Creates a unique name for an anonymous class.createLocalTypeName(String localTypeName) Creates a unique name for a local class or interface.Returns the member type with the given name.getMethodDeclaration(String name) Returns the first method declared with the given name.voidInvalidates the method cache of theresolvedType.voidsetEnclosingScope(Java.Scope enclosingScope) Sets the enclosing scope of thisJava.TypeDeclaration.voidthrowCompileException(String message) Throws aCompileExceptionwith the given message and this object's location.abstract StringtoString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Java.TypeDeclaration
accept, getClassName
-
Field Details
-
location
-
modifiers
-
typeParameters
-
declaredMethods
-
declaredClassesAndInterfaces
-
enclosingScope
-
resolvedType
-
anonymousClassCount
public int anonymousClassCountFor naming anonymous classes. -
localClassCount
public int localClassCountFor naming local classes.
-
-
Constructor Details
-
AbstractTypeDeclaration
public AbstractTypeDeclaration(Location location, Java.Modifier[] modifiers, @Nullable Java.TypeParameter[] typeParameters)
-
-
Method Details
-
setEnclosingScope
Sets the enclosing scope of thisJava.TypeDeclaration. -
getModifiers
-
getAnnotations
- Specified by:
getAnnotationsin interfaceJava.Annotatable- Returns:
- The annotations of this
Java.TypeDeclaration,Java.FieldDeclaration,Java.MethodDeclaratororJava.ConstructorDeclarator
-
getOptionalTypeParameters
-
getEnclosingScope
- Specified by:
getEnclosingScopein interfaceJava.Scope- Returns:
- The scope that encloses this scope, or
null
-
invalidateMethodCaches
public void invalidateMethodCaches()Invalidates the method cache of theresolvedType. This is necessary when methods are added during compilation -
addMemberTypeDeclaration
Adds oneJava.MemberTypeDeclarationto this type. -
addDeclaredMethod
Adds oneJava.MethodDeclaratorto this type. -
getMemberTypeDeclarations
- Specified by:
getMemberTypeDeclarationsin interfaceJava.TypeDeclaration- Returns:
- The (possibly empty) set of member types declared inside this
Java.TypeDeclaration
-
getMemberTypeDeclaration
Description copied from interface:Java.TypeDeclarationReturns the member type with the given name.- Specified by:
getMemberTypeDeclarationin interfaceJava.TypeDeclaration- Returns:
nullif a member type with that name is not declared
-
getMethodDeclaration
Description copied from interface:Java.TypeDeclarationReturns the first method declared with the given name. (Does not honor inherited methods.)- Specified by:
getMethodDeclarationin interfaceJava.TypeDeclaration- Returns:
nullif a method with this name is not declared
-
getMethodDeclarations
- Specified by:
getMethodDeclarationsin interfaceJava.TypeDeclaration- Returns:
- The list of methods declared in this
Java.TypeDeclaration, not including methods declared in supertypes
-
createLocalTypeName
Description copied from interface:Java.TypeDeclarationCreates a unique name for a local class or interface.- Specified by:
createLocalTypeNamein interfaceJava.TypeDeclaration
-
createAnonymousClassName
Description copied from interface:Java.TypeDeclarationCreates a unique name for an anonymous class.- Specified by:
createAnonymousClassNamein interfaceJava.TypeDeclaration
-
getLocation
- Specified by:
getLocationin interfaceJava.Locatable- Returns:
- The location of this object
-
throwCompileException
Description copied from interface:Java.LocatableThrows aCompileExceptionwith the given message and this object's location.- Specified by:
throwCompileExceptionin interfaceJava.Locatable- Parameters:
message- The message to report- Throws:
CompileException
-
toString
-