Chapter 7. Enumerated Types
Prev |  | Next

## Chapter 7. Enumerated Types

## Enumerated Types in Java 5

Java 5 (and hence AspectJ 5) provides explicit support for enumerated types. In the simplest case, you can declare an enumerated type as follows:

          public enum ProgrammingLanguages {
           COBOL,C,JAVA,ASPECTJ
          }

Enumerated types are just classes, and they can contain method and field declarations, and may implement interfaces. Enums may only have private constructors, and may not be extended.

Enumerated types in Java 5 all implicitly extend the type `java.lang.Enum`. It is illegal to explicitly declare a subtype of this class.

Prev | Home | Next
Using Variable-length arguments in advice and pointcut expressions | Up | Enumerated Types in AspectJ 5