org.netbeans.api.java.source
public final class ElementUtilities extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ElementUtilities.ElementAcceptor
Filter
Element s |
Modifier and Type | Method and Description |
---|---|
boolean |
alreadyDefinedIn(CharSequence name,
ExecutableType method,
TypeElement enclClass)
Returns true if a method specified by name and type is defined in a
class type.
|
Element |
elementFor(com.sun.javadoc.Doc doc)
Find a
Element corresponding to a given Doc . |
TypeElement |
enclosingTypeElement(Element element)
Returns the type element within which this member or constructor
is declared.
|
List<? extends ExecutableElement> |
findUnimplementedMethods(TypeElement impl)
Find all methods in given type and its supertypes, which are not implemented.
|
static String |
getBinaryName(TypeElement element)
Returns a binary name of a type.
|
Iterable<? extends TypeElement> |
getGlobalTypes(ElementUtilities.ElementAcceptor acceptor)
Return
TypeElement s:
which are imported
which are in the same package as the current file
which are in the java.lang package
|
Element |
getImplementationOf(ExecutableElement method,
TypeElement origin)
Returns the implementation of a method in class origin; null if none exists.
|
Iterable<? extends Element> |
getLocalMembersAndVars(Scope scope,
ElementUtilities.ElementAcceptor acceptor)
Return members declared in the given scope.
|
Iterable<? extends Element> |
getLocalVars(Scope scope,
ElementUtilities.ElementAcceptor acceptor)
Return variables declared in the given scope.
|
Iterable<? extends Element> |
getMembers(TypeMirror type,
ElementUtilities.ElementAcceptor acceptor)
Returns all members of a type, whether inherited or
declared directly.
|
ExecutableElement |
getOverriddenMethod(ExecutableElement method)
Returns the parent method which the specified method overrides, or null
if the method does not override a parent class method.
|
boolean |
implementsMethod(ExecutableElement element)
Returns true if this element represents a method which
implements a method in an interface the parent class implements.
|
boolean |
isLocal(Element element)
Returns true if the element is declared (directly or indirectly) local
to a method or variable initializer.
|
boolean |
isMemberOf(Element e,
TypeElement type)
Returns true if a type element has the specified element as a member.
|
boolean |
isSynthetic(Element element)
Returns true if the given element is synthetic.
|
com.sun.javadoc.Doc |
javaDocFor(Element element)
Get javadoc for given element.
|
TypeElement |
outermostTypeElement(Element element)
The outermost TypeElement which indirectly encloses this element.
|
boolean |
overridesMethod(ExecutableElement element)
Returns true if this element represents a method which overrides a
method in one of its superclasses.
|
public TypeElement enclosingTypeElement(Element element) throws IllegalArgumentException
IllegalArgumentException
- if the provided element is a package elementpublic TypeElement outermostTypeElement(Element element)
public Element getImplementationOf(ExecutableElement method, TypeElement origin)
public boolean isSynthetic(Element element)
element
- to checkpublic boolean overridesMethod(ExecutableElement element)
public static String getBinaryName(TypeElement element) throws IllegalArgumentException
element
- for which the binary name should be returnedIllegalArgumentException
- when the element is not a javac elementpublic com.sun.javadoc.Doc javaDocFor(Element element)
public Element elementFor(com.sun.javadoc.Doc doc)
Element
corresponding to a given Doc
.public Iterable<? extends Element> getMembers(TypeMirror type, ElementUtilities.ElementAcceptor acceptor)
type
- the type being examinedacceptor
- to filter the membersElements.getAllMembers(javax.lang.model.element.TypeElement)
public Iterable<? extends Element> getLocalMembersAndVars(Scope scope, ElementUtilities.ElementAcceptor acceptor)
public Iterable<? extends Element> getLocalVars(Scope scope, ElementUtilities.ElementAcceptor acceptor)
public Iterable<? extends TypeElement> getGlobalTypes(ElementUtilities.ElementAcceptor acceptor)
TypeElement
s:
public boolean isLocal(Element element)
public boolean alreadyDefinedIn(CharSequence name, ExecutableType method, TypeElement enclClass)
public boolean isMemberOf(Element e, TypeElement type)
public ExecutableElement getOverriddenMethod(ExecutableElement method)
public boolean implementsMethod(ExecutableElement element)
public List<? extends ExecutableElement> findUnimplementedMethods(TypeElement impl)
type
- to inspectBuilt on March 18 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.