checkers.util
Class ElementUtils

java.lang.Object
  extended by checkers.util.ElementUtils

public class ElementUtils
extends Object

A Utility class for analyzing Elements


Method Summary
Modifier and Type Method and Description
static TypeElement enclosingClass(Element elem)
          Returns the innermost type element enclosing the given element
static Name getQualifiedClassName(Element element)
          Returns the qualified name of the inner most class enclosing the provided Element
static TypeMirror getType(Element element)
          Returns the TypeMirror for usage of Element as a value.
static boolean isFinal(Element element)
          Returns true if the element is a final element: a final field, final method, or final class
static boolean isObject(TypeElement element)
          Check if the element is an element for 'java.lang.Object'
static boolean isStatic(Element element)
          Returns true if the element is a static element: whether it is a static field, static method, or static class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

enclosingClass

public static TypeElement enclosingClass(Element elem)
Returns the innermost type element enclosing the given element

Parameters:
elem - the enclosed element of a class
Returns:
the innermost type element

isStatic

public static boolean isStatic(Element element)
Returns true if the element is a static element: whether it is a static field, static method, or static class

Parameters:
element -
Returns:
true if element is static

isFinal

public static boolean isFinal(Element element)
Returns true if the element is a final element: a final field, final method, or final class

Parameters:
element -
Returns:
true if the element is final

getType

public static TypeMirror getType(Element element)
Returns the TypeMirror for usage of Element as a value. It returns the return type of a method element, the class type of a constructor, or simply the type mirror of the element itself.

Parameters:
element -
Returns:
the type for the element used as a value

getQualifiedClassName

@Nullable
public static Name getQualifiedClassName(Element element)
Returns the qualified name of the inner most class enclosing the provided Element

Parameters:
element - an element enclosed by a class, or a TypeElement
Returns:
The qualified Name of the innermost class enclosing the element

isObject

public static boolean isObject(TypeElement element)
Check if the element is an element for 'java.lang.Object'

Parameters:
element - the type element
Returns:
true iff the element is java.lang.Object element