Class CommentableExtension
java.lang.Object
org.emftext.language.java.extensions.commons.CommentableExtension
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAfterContainingStatement(Commentable me, Statement statementToAdd) Adds the given statement after the statement that contains this element.static voidaddBeforeContainingStatement(Commentable me, Statement statementToAdd) Adds the given statement before the statement that contains this element.static InterfaceFinds theInterfacerepresentingjava.lang.annotation.Annotation.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 ClassFinds theClassrepresentingjava.lang.Class.static ConcreteClassifiergetConcreteClassifier(Commentable me, String name) Finds theConcreteClassifierrepresenting the class with the given classified name.static EList<ConcreteClassifier>getConcreteClassifiers(Commentable me, String packageName, String classifierQuery) Finds allConcreteClassifierrepresenting the classes in the given package or a single class from that package.static AnnotationInstanceFinds the containing annotation instance for the given element.static AnonymousClassFinds the containing anonymous class for the given element.static CompilationUnitFinds the containing compilation unit for the given element.static ConcreteClassifierFinds the containing classifier for the given element.static EObjectgetFirstChildByEType(Commentable me, EClass type) Searches for the first child with the given type.static <T> TgetFirstChildByType(Commentable me, Class<T> type) Searches for the first child with the given type.static ClassgetLibClass(Commentable me, String name) Finds theClassrepresenting the class with the given name located injava.lang.static InterfacegetLibInterface(Commentable me, String name) Finds theInterfacerepresenting the interface with the given name located injava.lang.static ClassFinds theClassrepresentingjava.lang.Object.static EObjectgetParentByEType(Commentable me, EClass type) Walks up the containment hierarchy and returns the first parent with the given type.static <T> TgetParentByType(Commentable me, Class<T> type) Walks up the containment hierarchy and returns the first parent with the given type.static ConcreteClassifierFinds the classifier that is the parent of this element.static ClassFinds theClassrepresentingjava.lang.String.
-
Constructor Details
-
CommentableExtension
public CommentableExtension()
-
-
Method Details
-
addBeforeContainingStatement
Adds the given statement before the statement that contains this element.- Parameters:
me- the context in which the statement is added.statementToAdd- the statement to add.
-
addAfterContainingStatement
Adds the given statement after the statement that contains this element.- Parameters:
me- the context in which the statement is added.statementToAdd- the statement to add.
-
getParentByEType
Walks up the containment hierarchy and returns the first parent with the given type. If no such parent is found, null is returned.- Parameters:
me- the start object.type- the given type.- Returns:
- the found parent or null.
-
getParentByType
Walks up the containment hierarchy and returns the first parent with the given type. If no such parent is found, null is returned.- Type Parameters:
T- the given type.- Parameters:
me- the start object.type- class object of the given type.- Returns:
- the found parent or null.
-
getFirstChildByEType
Searches for the first child with the given type. If no such child is found,nullis returned.- Parameters:
me- the start object.type- the given type.- Returns:
- the found child or null.
-
getFirstChildByType
Searches for the first child with the given type. If no such child is found,nullis returned.- Type Parameters:
T- the given type.- Parameters:
me- the start object.type- class object of the given type.- Returns:
- the found child or null.
-
getChildrenByEType
Returns all children of the given type.- Parameters:
me- the start object.type- the given type.- Returns:
- all children.
-
getChildrenByType
Returns all children of the given type.- Type Parameters:
T- the given type.- Parameters:
me- the start object.type- class object of the type.- Returns:
- the children.
-
getConcreteClassifier
Finds theConcreteClassifierrepresenting the class with the given classified name.- Parameters:
me- the context.name- classified name of the ConcreteClassifier- Returns:
- the classifier.
-
getConcreteClassifiers
public static EList<ConcreteClassifier> getConcreteClassifiers(Commentable me, String packageName, String classifierQuery) Finds allConcreteClassifierrepresenting the classes in the given package or a single class from that package.- Parameters:
me- the context.packageName- name of the packageclassifierQuery- * for all classifiers or name of a single classifier- Returns:
- the classifier.
-
getLibClass
Finds theClassrepresenting the class with the given name located injava.lang.- Parameters:
me- the context.name- name of the Class.- Returns:
- the Class.
-
getLibInterface
Finds theInterfacerepresenting the interface with the given name located injava.lang.- Parameters:
me- the context.name- name of the Interface.- Returns:
- the interface.
-
getClassClass
Finds theClassrepresentingjava.lang.Class.- Parameters:
me- the context.- Returns:
- the Class.
-
getObjectClass
Finds theClassrepresentingjava.lang.Object.- Parameters:
me- the context.- Returns:
- the Class.
-
getStringClass
Finds theClassrepresentingjava.lang.String.- Parameters:
me- the context.- Returns:
- the Class.
-
getAnnotationInterface
Finds theInterfacerepresentingjava.lang.annotation.Annotation.- Parameters:
me- the context.- Returns:
- the Class.
-
getContainingConcreteClassifier
Finds the containing classifier for the given element.- Parameters:
me- the context.- Returns:
- containing classifier
-
getParentConcreteClassifier
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.- Parameters:
me- the context.- Returns:
- containing classifier
-
getContainingAnonymousClass
Finds the containing anonymous class for the given element.- Parameters:
me- the context.- Returns:
- containing anonymous class
-
getContainingCompilationUnit
Finds the containing compilation unit for the given element.- Parameters:
me- the given element.- Returns:
- containing compilation unit
-
getContainingAnnotationInstance
Finds the containing annotation instance for the given element.- Parameters:
me- the given element.- Returns:
- containing annotation instance
-
getContainingPackageName
-
getContainingContainerName
-