43 * @jls 8.4.3 Method Modifiers
44 * @jls 8.8.3 Constructor Modifiers
45 * @jls 9.1.1 Interface Modifiers
46 *
47 * @since 1.6
48 */
49
50 public enum Modifier {
51
52 // Note java.lang.reflect.Modifier includes INTERFACE, but that's a VMism.
53
54 /** The modifier {@code public} */ PUBLIC,
55 /** The modifier {@code protected} */ PROTECTED,
56 /** The modifier {@code private} */ PRIVATE,
57 /** The modifier {@code abstract} */ ABSTRACT,
58 /**
59 * The modifier {@code default}
60 * @since 1.8
61 */
62 DEFAULT,
63 /** The modifier {@code static} */ STATIC,
64
65 /**
66 * The modifier {@code sealed}
67 * @since 17
68 */
69 SEALED,
70
71 /**
72 * The modifier {@code non-sealed}
73 * @since 17
74 */
75 NON_SEALED {
76 public String toString() {
77 return "non-sealed";
78 }
79 },
80 /** The modifier {@code final} */ FINAL,
81 /** The modifier {@code transient} */ TRANSIENT,
82 /** The modifier {@code volatile} */ VOLATILE,
83 /** The modifier {@code synchronized} */ SYNCHRONIZED,
84 /** The modifier {@code native} */ NATIVE,
85 /** The modifier {@code strictfp} */ STRICTFP;
86
87 /**
88 * Returns this modifier's name as defined in <cite>The
89 * Java Language Specification</cite>.
90 * The modifier name is the {@linkplain #name() name of the enum
91 * constant} in lowercase and with any underscores ("{@code _}")
92 * replaced with hyphens ("{@code -}").
93 * @return the modifier's name
94 */
95 @Override
96 public String toString() {
97 return name().toLowerCase(java.util.Locale.US);
98 }
99 }
|
43 * @jls 8.4.3 Method Modifiers
44 * @jls 8.8.3 Constructor Modifiers
45 * @jls 9.1.1 Interface Modifiers
46 *
47 * @since 1.6
48 */
49
50 public enum Modifier {
51
52 // Note java.lang.reflect.Modifier includes INTERFACE, but that's a VMism.
53
54 /** The modifier {@code public} */ PUBLIC,
55 /** The modifier {@code protected} */ PROTECTED,
56 /** The modifier {@code private} */ PRIVATE,
57 /** The modifier {@code abstract} */ ABSTRACT,
58 /**
59 * The modifier {@code default}
60 * @since 1.8
61 */
62 DEFAULT,
63
64 /** The modifier {@code static} */ STATIC,
65
66 /**
67 * The modifier {@code sealed}
68 * @since 17
69 */
70 SEALED,
71
72 /**
73 * The modifier {@code non-sealed}
74 * @since 17
75 */
76 NON_SEALED {
77 public String toString() {
78 return "non-sealed";
79 }
80 },
81
82 /**
83 * The modifier {@code primitive}
84 * @since 18
85 */
86 PRIMITIVE,
87
88 /**
89 * The modifier {@code value}
90 * @since 18
91 */
92 VALUE,
93
94 /**
95 * The modifier {@code identity}
96 * @since 18
97 */
98 IDENTITY,
99
100 /** The modifier {@code final} */ FINAL,
101 /** The modifier {@code transient} */ TRANSIENT,
102 /** The modifier {@code volatile} */ VOLATILE,
103 /** The modifier {@code synchronized} */ SYNCHRONIZED,
104 /** The modifier {@code native} */ NATIVE,
105 /** The modifier {@code strictfp} */ STRICTFP;
106
107 /**
108 * Returns this modifier's name as defined in <cite>The
109 * Java Language Specification</cite>.
110 * The modifier name is the {@linkplain #name() name of the enum
111 * constant} in lowercase and with any underscores ("{@code _}")
112 * replaced with hyphens ("{@code -}").
113 * @return the modifier's name
114 */
115 @Override
116 public String toString() {
117 return name().toLowerCase(java.util.Locale.US);
118 }
119 }
|