Class CommentableExtension
- java.lang.Object
-
- org.emftext.language.java.extensions.commons.CommentableExtension
-
public class CommentableExtension extends Object
-
-
Constructor Summary
Constructors Constructor Description CommentableExtension()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addAfterContainingStatement(Commentable me, Statement statementToAdd)
Adds the given statement after the statement that contains this element.static void
addBeforeContainingStatement(Commentable me, Statement statementToAdd)
Adds the given statement before the statement that contains this element.static Interface
getAnnotationInterface(Commentable me)
Finds theInterface
representingjava.lang.annotation.Annotation
.static EList<EObject>
getChildrenByEType(Commentable me, EClass type)
Returns all children of the given type.static <T> EList<T>
getChildrenByType(Commentable me, Class<T> type)
Returns all children of the given type.static Class
getClassClass(Commentable me)
Finds theClass
representingjava.lang.Class
.static ConcreteClassifier
getConcreteClassifier(Commentable me, String name)
Finds theConcreteClassifier
representing the class with the given classified name.static EList<ConcreteClassifier>
getConcreteClassifiers(Commentable me, String packageName, String classifierQuery)
Finds allConcreteClassifier
representing the classes in the given package or a single class from that package.static AnnotationInstance
getContainingAnnotationInstance(Commentable me)
Finds the containing annotation instance for the given element.static AnonymousClass
getContainingAnonymousClass(Commentable me)
Finds the containing anonymous class for the given element.static CompilationUnit
getContainingCompilationUnit(Commentable me)
Finds the containing compilation unit for the given element.static ConcreteClassifier
getContainingConcreteClassifier(Commentable me)
Finds the containing classifier for the given element.static EList<String>
getContainingContainerName(Commentable me)
static EList<String>
getContainingPackageName(Commentable me)
static EObject
getFirstChildByEType(Commentable me, EClass type)
Searches for the first child with the given type.static <T> T
getFirstChildByType(Commentable me, Class<T> type)
Searches for the first child with the given type.static Class
getLibClass(Commentable me, String name)
Finds theClass
representing the class with the given name located injava.lang
.static Interface
getLibInterface(Commentable me, String name)
Finds theInterface
representing the interface with the given name located injava.lang
.static Class
getObjectClass(Commentable me)
Finds theClass
representingjava.lang.Object
.static EObject
getParentByEType(Commentable me, EClass type)
Walks up the containment hierarchy and returns the first parent with the given type.static <T> T
getParentByType(Commentable me, Class<T> type)
Walks up the containment hierarchy and returns the first parent with the given type.static ConcreteClassifier
getParentConcreteClassifier(Commentable me)
Finds the classifier that is the parent of this element.static Class
getStringClass(Commentable me)
Finds theClass
representingjava.lang.String
.
-
-
-
Method Detail
-
addBeforeContainingStatement
public static void addBeforeContainingStatement(Commentable me, Statement statementToAdd)
Adds the given statement before the statement that contains this element.
-
addAfterContainingStatement
public static void addAfterContainingStatement(Commentable me, Statement statementToAdd)
Adds the given statement after the statement that contains this element.
-
getParentByEType
public static EObject getParentByEType(Commentable me, EClass type)
Walks up the containment hierarchy and returns the first parent with the given type. If no such parent is found, null is returned.
-
getParentByType
public static <T> T getParentByType(Commentable me, Class<T> type)
Walks up the containment hierarchy and returns the first parent with the given type. If no such parent is found, null is returned.
-
getFirstChildByEType
public static EObject getFirstChildByEType(Commentable me, EClass type)
Searches for the first child with the given type. If no such child is found,null
is returned.
-
getFirstChildByType
public static <T> T getFirstChildByType(Commentable me, Class<T> type)
Searches for the first child with the given type. If no such child is found,null
is returned.
-
getChildrenByEType
public static EList<EObject> getChildrenByEType(Commentable me, EClass type)
Returns all children of the given type.
-
getChildrenByType
public static <T> EList<T> getChildrenByType(Commentable me, Class<T> type)
Returns all children of the given type.
-
getConcreteClassifier
public static ConcreteClassifier getConcreteClassifier(Commentable me, String name)
Finds theConcreteClassifier
representing the class with the given classified name.- Parameters:
name
- classified name of the ConcreteClassifier
-
getConcreteClassifiers
public static EList<ConcreteClassifier> getConcreteClassifiers(Commentable me, String packageName, String classifierQuery)
Finds allConcreteClassifier
representing the classes in the given package or a single class from that package.- Parameters:
packageName
- name of the packageclassifierQuery
- * for all classifiers or name of a single classifier
-
getLibClass
public static Class getLibClass(Commentable me, String name)
Finds theClass
representing the class with the given name located injava.lang
.- Parameters:
name
- name of the Class.- Returns:
- the Class.
-
getLibInterface
public static Interface getLibInterface(Commentable me, String name)
Finds theInterface
representing the interface with the given name located injava.lang
.- Parameters:
name
- name of the Interface.- Returns:
- the interface.
-
getClassClass
public static Class getClassClass(Commentable me)
Finds theClass
representingjava.lang.Class
.- Returns:
- the Class.
-
getObjectClass
public static Class getObjectClass(Commentable me)
Finds theClass
representingjava.lang.Object
.- Returns:
- the Class.
-
getStringClass
public static Class getStringClass(Commentable me)
Finds theClass
representingjava.lang.String
.- Returns:
- the Class.
-
getAnnotationInterface
public static Interface getAnnotationInterface(Commentable me)
Finds theInterface
representingjava.lang.annotation.Annotation
.- Returns:
- the Class.
-
getContainingConcreteClassifier
public static ConcreteClassifier getContainingConcreteClassifier(Commentable me)
Finds the containing classifier for the given element.- Parameters:
value
-- Returns:
- containing classifier
-
getParentConcreteClassifier
public static ConcreteClassifier getParentConcreteClassifier(Commentable me)
Finds the classifier that is the parent of this element. If this element is an inner classifier the parent classifier does not necessarily contain this element, since it can reside in a different compilation unit when stored in byte code.- Returns:
- containing classifier
-
getContainingAnonymousClass
public static AnonymousClass getContainingAnonymousClass(Commentable me)
Finds the containing anonymous class for the given element.- Returns:
- containing anonymous class
-
getContainingCompilationUnit
public static CompilationUnit getContainingCompilationUnit(Commentable me)
Finds the containing compilation unit for the given element.- Returns:
- containing compilation unit
-
getContainingAnnotationInstance
public static AnnotationInstance getContainingAnnotationInstance(Commentable me)
Finds the containing annotation instance for the given element.- Returns:
- containing annotation instance
-
getContainingPackageName
public static EList<String> getContainingPackageName(Commentable me)
-
getContainingContainerName
public static EList<String> getContainingContainerName(Commentable me)
-
-