Package org.codehaus.janino

# Class Java.AbstractClassDeclaration

java.lang.Object
org.codehaus.janino.Java.AbstractTypeDeclaration
org.codehaus.janino.Java.AbstractClassDeclaration

All Implemented Interfaces:
  `Java.Annotatable`, `Java.ClassDeclaration`, `Java.Locatable`, `Java.Scope`, `Java.TypeDeclaration`

Direct Known Subclasses:
  `Java.AnonymousClassDeclaration`, `Java.EnumConstant`, `Java.NamedClassDeclaration`

Enclosing class:
  `Java`

public abstract static class Java.AbstractClassDeclaration extends Java.AbstractTypeDeclaration implements Java.ClassDeclaration
Base for the various class declaration kinds.

## Field Summary

Fields
Modifier and Type
Field
Description
`final List<Java.ConstructorDeclarator>`
`constructors`
List of `Java.ConstructorDeclarator`s of this class.
`final List<Java.FieldDeclarationOrInitializer>`
`fieldDeclarationsAndInitializers`
List of `Java.TypeBodyDeclaration`s of this class: Field declarations (both static and non-static), (static and non-static) initializers (a.k.a.

### Fields inherited from class org.codehaus.janino.Java.AbstractTypeDeclaration

`anonymousClassCount, localClassCount`

## Constructor Summary

Constructors
Constructor
Description
`AbstractClassDeclaration(Location location, Java.Modifier[] modifiers, Java.TypeParameter[] typeParameters)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addConstructor(Java.ConstructorDeclarator cd)`
Adds one `Java.ConstructorDeclarator` to this class.
`void`
`addFieldDeclaration(Java.FieldDeclaration fd)`
Adds one field declaration to this class.
`void`
`addFieldDeclarationOrInitializer(Java.FieldDeclarationOrInitializer fdoi)`
Adds one field declaration or initializer to this class.
`void`
`addInitializer(Java.Initializer i)`
Adds one initializer to this class.
`void`
`defineSyntheticField(IClass.IField iField)`
`SortedMap<String,IClass.IField>`
`getSyntheticFields()`
`List<Java.FieldDeclarationOrInitializer>`
`getVariableDeclaratorsAndInitializers()`
Returns the initializers for class variables (JLS7 8.3.2.1) and instance variables (JLS7 8.3.2.2), and the instance initializers (JLS7 8.6) and static initializers (JLS7 8.7) in the order as they appear in the type declaration.

### Methods inherited from class org.codehaus.janino.Java.AbstractTypeDeclaration

`addDeclaredMethod, addMemberTypeDeclaration, createAnonymousClassName, createLocalTypeName, getAnnotations, getEnclosingScope, getLocation, getMemberTypeDeclaration, getMemberTypeDeclarations, getMethodDeclaration, getMethodDeclarations, getModifiers, getOptionalTypeParameters, invalidateMethodCaches, setEnclosingScope, throwCompileException, toString`

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

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

### Methods inherited from interface org.codehaus.janino.Java.Annotatable

`getAnnotations`

### Methods inherited from interface org.codehaus.janino.Java.Locatable

`getLocation, throwCompileException`

### Methods inherited from interface org.codehaus.janino.Java.Scope

`getEnclosingScope`

### Methods inherited from interface org.codehaus.janino.Java.TypeDeclaration

`accept, createAnonymousClassName, createLocalTypeName, getClassName, getMemberTypeDeclaration, getMemberTypeDeclarations, getMethodDeclaration, getMethodDeclarations`

## Field Details

### constructors

public final List<Java.ConstructorDeclarator> constructors
List of `Java.ConstructorDeclarator`s of this class.

### fieldDeclarationsAndInitializers

public final List<Java.FieldDeclarationOrInitializer> fieldDeclarationsAndInitializers
List of `Java.TypeBodyDeclaration`s of this class: Field declarations (both static and non-static), (static and non-static) initializers (a.k.a. "class initializers" and "instance initializers").

## Constructor Details

### AbstractClassDeclaration

public AbstractClassDeclaration(Location location, Java.Modifier[] modifiers, @Nullable Java.TypeParameter[] typeParameters)

## Method Details

### addConstructor

public void addConstructor(Java.ConstructorDeclarator cd)
Adds one `Java.ConstructorDeclarator` to this class.

### addFieldDeclaration

public void addFieldDeclaration(Java.FieldDeclaration fd)
Adds one field declaration to this class.

### addInitializer

public void addInitializer(Java.Initializer i)
Adds one initializer to this class.

### addFieldDeclarationOrInitializer

public void addFieldDeclarationOrInitializer(Java.FieldDeclarationOrInitializer fdoi)
Adds one field declaration or initializer to this class.

### defineSyntheticField

public void defineSyntheticField(IClass.IField iField) throws CompileException

Throws:
  `CompileException`
See Also:
  - `Java.InnerClassDeclaration.defineSyntheticField(IClass.IField)`

### getVariableDeclaratorsAndInitializers

public List<Java.FieldDeclarationOrInitializer> getVariableDeclaratorsAndInitializers()
Description copied from interface: `Java.ClassDeclaration`
Returns the initializers for class variables (JLS7 8.3.2.1) and instance variables (JLS7 8.3.2.2), and the instance initializers (JLS7 8.6) and static initializers (JLS7 8.7) in the order as they appear in the type declaration.

Specified by:
  `getVariableDeclaratorsAndInitializers` in interface `Java.ClassDeclaration`

### getSyntheticFields

public SortedMap<String,IClass.IField> getSyntheticFields()

Specified by:
  `getSyntheticFields` in interface `Java.ClassDeclaration`
Returns:
  The synthetic fields that were created while this type declaration was compiled