Package org.codehaus.janino.samples

# Class DeclarationCounter

java.lang.Object
org.codehaus.janino.util.AbstractTraverser<RuntimeException>
org.codehaus.janino.samples.DeclarationCounter

All Implemented Interfaces:
  `Traverser<RuntimeException>`

public class DeclarationCounter extends AbstractTraverser<RuntimeException>
An example application for the `Traverser`: Reads, scans and parses the files named on the command line and counts several kinds of declarations.

## Constructor Summary

Constructors
Constructor
Description
`DeclarationCounter()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`main(String[] args)`
`void`
`traverseClassDeclaration(Java.AbstractClassDeclaration cd)`
`void`
`traverseFieldDeclaration(Java.FieldDeclaration fd)`
`void`
`traverseInterfaceDeclaration(Java.InterfaceDeclaration id)`
`void`
`traverseLocalVariableDeclarationStatement(Java.LocalVariableDeclarationStatement lvds)`

### Methods inherited from class org.codehaus.janino.util.AbstractTraverser

`traverseAbstractCompilationUnit, traverseAbstractTypeBodyDeclaration, traverseAbstractTypeDeclaration, traverseAlternateConstructorInvocation, traverseAmbiguousName, traverseAnnotation, traverseAnonymousClassDeclaration, traverseArrayAccessExpression, traverseArrayCreationReference, traverseArrayInitializerOrRvalue, traverseArrayLength, traverseArrayType, traverseAssertStatement, traverseAssignment, traverseAtom, traverseBinaryOperation, traverseBlock, traverseBooleanLiteral, traverseBooleanRvalue, traverseBreakableStatement, traverseBreakStatement, traverseCast, traverseCharacterLiteral, traverseClassInstanceCreationReference, traverseClassLiteral, traverseCompilationUnit, traverseConditionalExpression, traverseConstructorDeclarator, traverseConstructorInvocation, traverseContinuableStatement, traverseContinueStatement, traverseCrement, traverseDoStatement, traverseElementValue, traverseElementValueArrayInitializer, traverseEmptyStatement, traverseEnumConstant, traverseExpressionStatement, traverseFieldAccess, traverseFieldAccessExpression, traverseFloatingPointLiteral, traverseForEachStatement, traverseFormalParameter, traverseFormalParameters, traverseForStatement, traverseFunctionDeclarator, traverseIfStatement, traverseImportDeclaration, traverseInitializer, traverseInstanceof, traverseIntegerLiteral, traverseInvocation, traverseLabeledStatement, traverseLambdaExpression, traverseLiteral, traverseLocalClassDeclaration, traverseLocalClassDeclarationStatement, traverseLocalVariableAccess, traverseLocalVariableDeclaratorResource, traverseLocated, traverseLvalue, traverseMarkerAnnotation, traverseMemberAnnotationTypeDeclaration, traverseMemberClassDeclaration, traverseMemberEnumDeclaration, traverseMemberInterfaceDeclaration, traverseMethodDeclarator, traverseMethodInvocation, traverseMethodReference, traverseModularCompilationUnit, traverseNamedClassDeclaration, traverseNewAnonymousClassInstance, traverseNewArray, traverseNewClassInstance, traverseNewInitializedArray, traverseNormalAnnotation, traverseNullLiteral, traversePackage, traversePackageMemberAnnotationTypeDeclaration, traversePackageMemberClassDeclaration, traversePackageMemberEnumDeclaration, traversePackageMemberInterfaceDeclaration, traverseParameterAccess, traverseParenthesizedExpression, traversePrimitiveType, traverseQualifiedThisReference, traverseReferenceType, traverseReturnStatement, traverseRvalue, traverseRvalueMemberType, traverseSimpleLiteral, traverseSimpleType, traverseSingleElementAnnotation, traverseSingleStaticImportDeclaration, traverseSingleTypeImportDeclaration, traverseStatement, traverseStaticImportOnDemandDeclaration, traverseStringLiteral, traverseSuperclassFieldAccessExpression, traverseSuperclassMethodInvocation, traverseSuperConstructorInvocation, traverseSwitchStatement, traverseSynchronizedStatement, traverseTextBlock, traverseThisReference, traverseThrowStatement, traverseTryStatement, traverseType, traverseTypeImportOnDemandDeclaration, traverseUnaryOperation, traverseVariableAccessResource, traverseWhileStatement, visitAbstractCompilationUnit, visitAnnotation, visitAtom, visitBlockStatement, visitElementValue, visitImportDeclaration, visitTypeBodyDeclaration, visitTypeDeclaration`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DeclarationCounter

public DeclarationCounter()

## Method Details

### main

public static void main(String[] args) throws CompileException, IOException

Throws:
  `CompileException`
  `IOException`

### traverseClassDeclaration

public void traverseClassDeclaration(Java.AbstractClassDeclaration cd)

Specified by:
  `traverseClassDeclaration` in interface `Traverser<RuntimeException>`
Overrides:
  `traverseClassDeclaration` in class `AbstractTraverser<RuntimeException>`

### traverseInterfaceDeclaration

public void traverseInterfaceDeclaration(Java.InterfaceDeclaration id)

Specified by:
  `traverseInterfaceDeclaration` in interface `Traverser<RuntimeException>`
Overrides:
  `traverseInterfaceDeclaration` in class `AbstractTraverser<RuntimeException>`

### traverseFieldDeclaration

public void traverseFieldDeclaration(Java.FieldDeclaration fd)

Specified by:
  `traverseFieldDeclaration` in interface `Traverser<RuntimeException>`
Overrides:
  `traverseFieldDeclaration` in class `AbstractTraverser<RuntimeException>`

### traverseLocalVariableDeclarationStatement

public void traverseLocalVariableDeclarationStatement(Java.LocalVariableDeclarationStatement lvds)

Specified by:
  `traverseLocalVariableDeclarationStatement` in interface `Traverser<RuntimeException>`
Overrides:
  `traverseLocalVariableDeclarationStatement` in class `AbstractTraverser<RuntimeException>`