FileDocCategorySizeDatePackage
DeclarationScanner.javaAPI DocJava SE 5 API5650Fri Aug 26 14:55:14 BST 2005com.sun.mirror.util

DeclarationScanner

public class DeclarationScanner extends Object implements DeclarationVisitor
A visitor for declarations that scans declarations contained within the given declaration. For example, when visiting a class, the methods, fields, constructors, and nested types of the class are also visited.

To control the processing done on a declaration, users of this class pass in their own visitors for pre and post processing. The preprocessing visitor is called before the contained declarations are scanned; the postprocessing visitor is called after the contained declarations are scanned.

author
Joseph D. Darcy
author
Scott Seligman
version
1.5 04/04/20
since
1.5

Fields Summary
protected DeclarationVisitor
pre
protected DeclarationVisitor
post
Constructors Summary
DeclarationScanner(DeclarationVisitor pre, DeclarationVisitor post)

	this.pre = pre;
	this.post = post;
    
Methods Summary
public voidvisitAnnotationTypeDeclaration(com.sun.mirror.declaration.AnnotationTypeDeclaration d)
Visits an annotation type declaration.

param
d the declaration to visit

	visitInterfaceDeclaration(d);
    
public voidvisitAnnotationTypeElementDeclaration(com.sun.mirror.declaration.AnnotationTypeElementDeclaration d)
Visits an annotation type element declaration.

param
d the declaration to visit

	visitMethodDeclaration(d);
    
public voidvisitClassDeclaration(com.sun.mirror.declaration.ClassDeclaration d)
Visits a class declaration.

param
d the declaration to visit

	d.accept(pre);

	for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
	    tpDecl.accept(this);
	}
	
	for(FieldDeclaration fieldDecl: d.getFields()) {
	    fieldDecl.accept(this);
	}
	
	for(MethodDeclaration methodDecl: d.getMethods()) {
	    methodDecl.accept(this);
	}
	
	for(TypeDeclaration typeDecl: d.getNestedTypes()) {
	    typeDecl.accept(this);
	}

	for(ConstructorDeclaration ctorDecl: d.getConstructors()) {
	    ctorDecl.accept(this);
	}

	d.accept(post);
    
public voidvisitConstructorDeclaration(com.sun.mirror.declaration.ConstructorDeclaration d)
Visits a constructor declaration.

param
d the declaration to visit

	visitExecutableDeclaration(d);
    
public voidvisitDeclaration(com.sun.mirror.declaration.Declaration d)
Visits a declaration.

param
d the declaration to visit

	d.accept(pre);
	d.accept(post);
    
public voidvisitEnumConstantDeclaration(com.sun.mirror.declaration.EnumConstantDeclaration d)
Visits an enum constant declaration.

param
d the declaration to visit

	visitFieldDeclaration(d);
    
public voidvisitEnumDeclaration(com.sun.mirror.declaration.EnumDeclaration d)
Visits an enum declaration.

param
d the declaration to visit

	visitClassDeclaration(d);
    
public voidvisitExecutableDeclaration(com.sun.mirror.declaration.ExecutableDeclaration d)
Visits a method or constructor declaration.

param
d the declaration to visit

	d.accept(pre);

	for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
	    tpDecl.accept(this);
	}

	for(ParameterDeclaration pDecl: d.getParameters()) {
	    pDecl.accept(this);
	}

	d.accept(post);
    
public voidvisitFieldDeclaration(com.sun.mirror.declaration.FieldDeclaration d)
Visits a field declaration.

param
d the declaration to visit

	visitMemberDeclaration(d);
    
public voidvisitInterfaceDeclaration(com.sun.mirror.declaration.InterfaceDeclaration d)
Visits an interface declaration.

param
d the declaration to visit

	visitTypeDeclaration(d);
    
public voidvisitMemberDeclaration(com.sun.mirror.declaration.MemberDeclaration d)
Visits a member or constructor declaration.

param
d the declaration to visit

	visitDeclaration(d);
    
public voidvisitMethodDeclaration(com.sun.mirror.declaration.MethodDeclaration d)
Visits a method declaration.

param
d the declaration to visit

	visitExecutableDeclaration(d);
    
public voidvisitPackageDeclaration(com.sun.mirror.declaration.PackageDeclaration d)
Visits a package declaration.

param
d the declaration to visit

	d.accept(pre);

	for(ClassDeclaration classDecl: d.getClasses()) {
	    classDecl.accept(this);
	}

	for(InterfaceDeclaration interfaceDecl: d.getInterfaces()) {
	    interfaceDecl.accept(this);
	}

	d.accept(post);
    
public voidvisitParameterDeclaration(com.sun.mirror.declaration.ParameterDeclaration d)
Visits a parameter declaration.

param
d the declaration to visit

	visitDeclaration(d);
    
public voidvisitTypeDeclaration(com.sun.mirror.declaration.TypeDeclaration d)
Visits a type declaration.

param
d the declaration to visit

	d.accept(pre);

	for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
	    tpDecl.accept(this);
	}
	
	for(FieldDeclaration fieldDecl: d.getFields()) {
	    fieldDecl.accept(this);
	}
	
	for(MethodDeclaration methodDecl: d.getMethods()) {
	    methodDecl.accept(this);
	}
	
	for(TypeDeclaration typeDecl: d.getNestedTypes()) {
	    typeDecl.accept(this);
	}

	d.accept(post);
    
public voidvisitTypeParameterDeclaration(com.sun.mirror.declaration.TypeParameterDeclaration d)
Visits a type parameter declaration.

param
d the declaration to visit

	visitDeclaration(d);