93 * you are looking for. 94 */ 95 OTHER, 96 97 // Constants added since initial release 98 99 /** 100 * A resource variable. 101 * @since 1.7 102 */ 103 RESOURCE_VARIABLE, 104 105 /** 106 * A module. 107 * @since 9 108 * @spec JPMS 109 */ 110 MODULE, 111 112 /** 113 * A record type. 114 * @since 14 115 * @deprecated This element kind is part of a preview feature and may be removed 116 * if the preview feature is removed. 117 */ 118 @Deprecated(forRemoval=true, since="14") 119 @SuppressWarnings("removal") 120 RECORD, 121 122 /** 123 * A record component of a {@code record}. 124 * @since 14 125 * @deprecated This element kind is part of a preview feature and may be removed 126 * if the preview feature is removed. 127 */ 128 @Deprecated(forRemoval=true, since="14") 129 @SuppressWarnings("removal") 130 RECORD_COMPONENT; 131 132 /** 133 * Returns {@code true} if this is a kind of class: 134 * either {@code CLASS} or {@code ENUM} or {@code RECORD}. 135 * 136 * @return {@code true} if this is a kind of class 137 */ 138 public boolean isClass() { 139 return this == CLASS || this == ENUM || this == RECORD; 140 } 141 142 /** 143 * Returns {@code true} if this is a kind of interface: 144 * either {@code INTERFACE} or {@code ANNOTATION_TYPE}. 145 * 146 * @return {@code true} if this is a kind of interface 147 */ 148 public boolean isInterface() { 149 return this == INTERFACE || this == ANNOTATION_TYPE; 150 } 151 152 /** 153 * Returns {@code true} if this is a kind of field: 154 * either {@code FIELD} or {@code ENUM_CONSTANT}. 155 * 156 * @return {@code true} if this is a kind of field 157 */ | 93 * you are looking for. 94 */ 95 OTHER, 96 97 // Constants added since initial release 98 99 /** 100 * A resource variable. 101 * @since 1.7 102 */ 103 RESOURCE_VARIABLE, 104 105 /** 106 * A module. 107 * @since 9 108 * @spec JPMS 109 */ 110 MODULE, 111 112 /** 113 * {@preview Associated with records, a preview feature of the Java language. 114 * 115 * This constant is associated with <i>records</i>, a preview 116 * feature of the Java language. Programs can only use this 117 * method when preview features are enabled. Preview features 118 * may be removed in a future release, or upgraded to permanent 119 * features of the Java language.} 120 * 121 * A record type. 122 * @since 14 123 */ 124 @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, 125 essentialAPI=false) 126 @SuppressWarnings("preview") 127 RECORD, 128 129 /** 130 * {@preview Associated with records, a preview feature of the Java language. 131 * 132 * This constant is associated with <i>records</i>, a preview 133 * feature of the Java language. Programs can only use this 134 * method when preview features are enabled. Preview features 135 * may be removed in a future release, or upgraded to permanent 136 * features of the Java language.} 137 * 138 * A record component of a {@code record}. 139 * @since 14 140 */ 141 @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, 142 essentialAPI=false) 143 @SuppressWarnings("preview") 144 RECORD_COMPONENT; 145 146 /** 147 * Returns {@code true} if this is a kind of class: 148 * either {@code CLASS} or {@code ENUM} or {@code RECORD}. 149 * 150 * @return {@code true} if this is a kind of class 151 */ 152 @SuppressWarnings("preview") 153 public boolean isClass() { 154 return this == CLASS || this == ENUM || this == RECORD; 155 } 156 157 /** 158 * Returns {@code true} if this is a kind of interface: 159 * either {@code INTERFACE} or {@code ANNOTATION_TYPE}. 160 * 161 * @return {@code true} if this is a kind of interface 162 */ 163 public boolean isInterface() { 164 return this == INTERFACE || this == ANNOTATION_TYPE; 165 } 166 167 /** 168 * Returns {@code true} if this is a kind of field: 169 * either {@code FIELD} or {@code ENUM_CONSTANT}. 170 * 171 * @return {@code true} if this is a kind of field 172 */ |