diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2013-02-01 17:58:29 +0100 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2013-02-01 17:58:29 +0100 |
commit | 09109d040a207e2a28d09dcccbfd703bb6d93773 (patch) | |
tree | a085d325f63e506faa8467a992655177735d033b | |
parent | de2bfc98081ec256ee86f4ed79cd565c6cd8af96 (diff) | |
download | classpath-09109d040a207e2a28d09dcccbfd703bb6d93773.tar.gz |
Document ElementKind fields and add missing methods.
2013-02-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/lang/model/element/ElementKind.java:
(ANNOTATION_TYPE): Documented.
(CLASS): Likewise.
(CONSTRUCTOR): Likewise.
(ENUM): Likewise.
(ENUM_CONSTANT): Likewise.
(EXCEPTION_PARAMETER): Likewise.
(FIELD): Likewise.
(INSTANCE_INIT): Likewise.
(INTERFACE): Likewise.
(LOCAL_VARIABLE): Likewise.
(METHOD): Likewise.
(OTHER): Likewise.
(PACKAGE): Likewise.
(PARAMETER): Likewise.
(STATIC_INIT): Likewise.
(TYPE_PARAMETER): Likewise.
(isClass()): Implemented.
(isField()): Likewise.
(isInterface()): Likewise.
Signed-off-by: Andrew John Hughes <gnu_andrew@member.fsf.org>
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | javax/lang/model/element/ElementKind.java | 53 |
2 files changed, 76 insertions, 0 deletions
@@ -1,5 +1,28 @@ 2013-02-01 Andrew John Hughes <gnu_andrew@member.fsf.org> + * javax/lang/model/element/ElementKind.java: + (ANNOTATION_TYPE): Documented. + (CLASS): Likewise. + (CONSTRUCTOR): Likewise. + (ENUM): Likewise. + (ENUM_CONSTANT): Likewise. + (EXCEPTION_PARAMETER): Likewise. + (FIELD): Likewise. + (INSTANCE_INIT): Likewise. + (INTERFACE): Likewise. + (LOCAL_VARIABLE): Likewise. + (METHOD): Likewise. + (OTHER): Likewise. + (PACKAGE): Likewise. + (PARAMETER): Likewise. + (STATIC_INIT): Likewise. + (TYPE_PARAMETER): Likewise. + (isClass()): Implemented. + (isField()): Likewise. + (isInterface()): Likewise. + +2013-02-01 Andrew John Hughes <gnu_andrew@member.fsf.org> + The type of element should be determined by its kind, not by the class. * javax/lang/model/util/ElementFilter.java: diff --git a/javax/lang/model/element/ElementKind.java b/javax/lang/model/element/ElementKind.java index b0bd7501a..b1765c547 100644 --- a/javax/lang/model/element/ElementKind.java +++ b/javax/lang/model/element/ElementKind.java @@ -47,20 +47,73 @@ package javax.lang.model.element; */ public enum ElementKind { + /** An annotation type. */ ANNOTATION_TYPE, + /** A normal class, not described by a more specific type. */ CLASS, + /** A constructor */ CONSTRUCTOR, + /** An enumeration */ ENUM, + /** A constant field used in an enumeration. */ ENUM_CONSTANT, + /** A parameter passed to an exception handler. */ EXCEPTION_PARAMETER, + /** A normal field, not described by a more specific type. */ FIELD, + /** An instance initializer. */ INSTANCE_INIT, + /** A normal interface, not described by a more specific type. */ INTERFACE, + /** A local variable. */ LOCAL_VARIABLE, + /** A method. */ METHOD, + /** An element reserved for implementation-specific usage. */ OTHER, + /** A package. */ PACKAGE, + /** A parameter passed to a method or constructor. */ PARAMETER, + /** A static initializer. */ STATIC_INIT, + /** A type parameter. */ TYPE_PARAMETER; + + /** + * Returns true if this element is a class i.e. either a + * general {@code CLASS} or the specific {@code ENUM}. + * + * @return true if this kind is either {@code CLASS} or + * {@code ENUM}. + */ + public boolean isClass() + { + return this == CLASS || this == ENUM; + } + + /** + * Returns true if this element is a field i.e. either a + * general {@code FIELD} or the specific {@code ENUM_CONSTANT}. + * + * @return true if this kind is either {@code FIELD} or + * {@code ENUM_CONSTANT}. + */ + public boolean isField() + { + return this == FIELD || this == ENUM_CONSTANT; + } + + /** + * Returns true if this element is a interface i.e. either a + * general {@code INTERFACE} or the specific {@code ANNOTATION_TYPE}. + * + * @return true if this kind is either {@code INTERFACE} or + * {@code ANNOTATION_TYPE}. + */ + public boolean isInterface() + { + return this == INTERFACE || this == ANNOTATION_TYPE; + } + } |