01: /*
02: * @(#)Modifier.java 1.1 04/01/26
03: *
04: * Copyright (c) 2004, Sun Microsystems, Inc.
05: * All rights reserved.
06: *
07: * Redistribution and use in source and binary forms, with or without
08: * modification, are permitted provided that the following conditions are met:
09: *
10: * * Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * * Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: * * Neither the name of the Sun Microsystems, Inc. nor the names of
16: * its contributors may be used to endorse or promote products derived from
17: * this software without specific prior written permission.
18: *
19: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20: * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22: * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
23: * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30: */
31:
32: package com.sun.mirror.declaration;
33:
34: /**
35: * Represents a modifier on the declaration of a program element such
36: * as a class, method, or field.
37: *
38: * <p> Not all modifiers are applicable to all kinds of declarations.
39: * When two or more modifiers appear in the source code of a declaration,
40: * then it is customary, though not required, that they appear in the same
41: * order as the constants listed in the detail section below.
42: *
43: * @author Joseph D. Darcy
44: * @author Scott Seligman
45: * @version 1.1 04/01/25
46: * @since 1.5
47: */
48:
49: public enum Modifier {
50:
51: // See JLS2 sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1.
52: // java.lang.reflect.Modifier includes INTERFACE, but that's a VMism.
53:
54: /** The modifier <tt>public</tt> */
55: PUBLIC,
56: /** The modifier <tt>protected</tt> */
57: PROTECTED,
58: /** The modifier <tt>private</tt> */
59: PRIVATE,
60: /** The modifier <tt>abstract</tt> */
61: ABSTRACT,
62: /** The modifier <tt>static</tt> */
63: STATIC,
64: /** The modifier <tt>final</tt> */
65: FINAL,
66: /** The modifier <tt>transient</tt> */
67: TRANSIENT,
68: /** The modifier <tt>volatile</tt> */
69: VOLATILE,
70: /** The modifier <tt>synchronized</tt> */
71: SYNCHRONIZED,
72: /** The modifier <tt>native</tt> */
73: NATIVE,
74: /** The modifier <tt>strictfp</tt> */
75: STRICTFP;
76:
77: private String lowercase = null; // modifier name in lowercase
78:
79: /**
80: * Returns this modifier's name in lowercase.
81: */
82: public String toString() {
83: if (lowercase == null) {
84: lowercase = name().toLowerCase(java.util.Locale.US);
85: }
86: return lowercase;
87: }
88: }
|