Class CommentableExtension
java.lang.Object
tools.mdsd.jamopp.model.java.extensions.commons.CommentableExtension
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAfterContainingStatement(Commentable commentable, Statement statementToAdd) Adds the given statement after the statement that contains this element.static voidaddBeforeContainingStatement(Commentable commentable, Statement statementToAdd) Adds the given statement before the statement that contains this element.static InterfacegetAnnotationInterface(Commentable commentable) Finds theInterfacerepresentingjava.lang.annotation.Annotation.getChildrenByEType(EObject eObject, EClassifier type) Returns all children of the given type.static <T> EList<T>getChildrenByType(EObject eObject, Class<T> type) Returns all children of the given type.static ClassgetClassClass(Commentable commentabke) Finds theClassrepresentingjava.lang.Class.static ConcreteClassifiergetConcreteClassifier(Commentable commentable, String name) Finds theConcreteClassifierrepresenting the class with the given classified name.static EList<ConcreteClassifier>getConcreteClassifiers(Commentable commentable, String packageName, String classifierQuery) Finds allConcreteClassifierrepresenting the classes in the given package or a single class from that package.static AnnotationInstancegetContainingAnnotationInstance(Commentable commentable) Finds the containing annotation instance for the given element.static AnonymousClassgetContainingAnonymousClass(Commentable commentable) Finds the containing anonymous class for the given element.static CompilationUnitgetContainingCompilationUnit(Commentable commentable) Finds the containing compilation unit for the given element.static ConcreteClassifiergetContainingConcreteClassifier(Commentable commentable) Finds the containing classifier for the given element.getContainingContainerName(Commentable commentable) getContainingPackageName(Commentable commentable) static EObjectgetFirstChildByEType(EObject eObject, EClassifier type) Searches for the first child with the given type.static <T> TgetFirstChildByType(EObject eObject, Class<T> type) Searches for the first child with the given type.static ClassgetLibClass(Commentable commentable, String name) Finds theClassrepresenting the class with the given name located injava.lang.static InterfacegetLibInterface(Commentable commentable, String name) Finds theInterfacerepresenting the interface with the given name located injava.lang.static ClassgetObjectClass(Commentable commentable) Finds theClassrepresentingjava.lang.Object.static EObjectgetParentByEType(EObject eObject, EClassifier type) Walks up the containment hierarchy and returns the first parent with the given type.static <T> TgetParentByType(EObject eObject, Class<T> type) Walks up the containment hierarchy and returns the first parent with the given type.static ConcreteClassifiergetParentConcreteClassifier(Commentable commentable) Finds the classifier that is the parent of this element.static ClassgetStringClass(Commentable commentable) Finds theClassrepresentingjava.lang.String.
-
Method Details
-
addBeforeContainingStatement
Adds the given statement before the statement that contains this element. -
addAfterContainingStatement
Adds the given statement after the statement that contains this element. -
getParentByEType
Walks up the containment hierarchy and returns the first parent with the given type. If no such parent is found, null is returned. -
getParentByType
Walks up the containment hierarchy and returns the first parent with the given type. If no such parent is found, null is returned. -
getFirstChildByEType
Searches for the first child with the given type. If no such child is found,nullis returned. -
getFirstChildByType
Searches for the first child with the given type. If no such child is found,nullis returned. -
getChildrenByEType
Returns all children of the given type. -
getChildrenByType
Returns all children of the given type. -
getConcreteClassifier
Finds theConcreteClassifierrepresenting the class with the given classified name.- Parameters:
commentable- unusedname- classified name of the ConcreteClassifier
-
getConcreteClassifiers
public static EList<ConcreteClassifier> getConcreteClassifiers(Commentable commentable, String packageName, String classifierQuery) Finds allConcreteClassifierrepresenting the classes in the given package or a single class from that package.- Parameters:
commentable- unusedpackageName- name of the packageclassifierQuery- * for all classifiers or name of a single classifier
-
getLibClass
Finds theClassrepresenting the class with the given name located injava.lang.- Parameters:
commentable- unusedname- name of the Class.- Returns:
- the Class.
-
getLibInterface
Finds theInterfacerepresenting the interface with the given name located injava.lang.- Parameters:
commentable- unusedname- name of the Interface.- Returns:
- the interface.
-
getClassClass
Finds theClassrepresentingjava.lang.Class.- Returns:
- the Class.
-
getObjectClass
Finds theClassrepresentingjava.lang.Object.- Returns:
- the Class.
-
getStringClass
Finds theClassrepresentingjava.lang.String.- Returns:
- the Class.
-
getAnnotationInterface
Finds theInterfacerepresentingjava.lang.annotation.Annotation.- Parameters:
commentable- unused- Returns:
- the Class.
-
getContainingConcreteClassifier
Finds the containing classifier for the given element.- Parameters:
value-- 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.- Returns:
- containing classifier
-
getContainingAnonymousClass
Finds the containing anonymous class for the given element.- Returns:
- containing anonymous class
-
getContainingCompilationUnit
Finds the containing compilation unit for the given element.- Returns:
- containing compilation unit
-
getContainingAnnotationInstance
Finds the containing annotation instance for the given element.- Returns:
- containing annotation instance
-
getContainingPackageName
-
getContainingContainerName
-