KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > element > Modifier


1 /*
2  * @(#)Modifier.java 1.3 06/07/11
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.element;
9
10
11 /**
12  * Represents a modifier on a program element such
13  * as a class, method, or field.
14  *
15  * <p>Not all modifiers are applicable to all kinds of elements.
16  * When two or more modifiers appear in the source code of an element
17  * then it is customary, though not required, that they appear in the same
18  * order as the constants listed in the detail section below.
19  *
20  * <p>Note that it is possible additional modifiers will be added in
21  * future versions of the platform.
22  *
23  * @author Joseph D. Darcy
24  * @author Scott Seligman
25  * @author Peter von der Ah&eacute;
26  * @version 1.3 06/07/11
27  * @since 1.6
28  */

29
30 public enum Modifier {
31
32     // See JLS2 sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1.
33
// java.lang.reflect.Modifier includes INTERFACE, but that's a VMism.
34

35     /** The modifier {@code public} */ PUBLIC,
36     /** The modifier {@code protected} */ PROTECTED,
37     /** The modifier {@code private} */ PRIVATE,
38     /** The modifier {@code abstract} */ ABSTRACT,
39     /** The modifier {@code static} */ STATIC,
40     /** The modifier {@code final} */ FINAL,
41     /** The modifier {@code transient} */ TRANSIENT,
42     /** The modifier {@code volatile} */ VOLATILE,
43     /** The modifier {@code synchronized} */ SYNCHRONIZED,
44     /** The modifier {@code native} */ NATIVE,
45     /** The modifier {@code strictfp} */ STRICTFP;
46
47
48     private String JavaDoc lowercase = null; // modifier name in lowercase
49

50     /**
51      * Returns this modifier's name in lowercase.
52      */

53     public String JavaDoc toString() {
54     if (lowercase == null) {
55        lowercase = name().toLowerCase(java.util.Locale.US);
56     }
57     return lowercase;
58     }
59 }
60
Popular Tags