Class CommentableExtension
java.lang.Object
tools.mdsd.jamopp.model.java.extensions.commons.CommentableExtension
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAfterContainingStatement
(Commentable commentable, Statement statementToAdd) Adds the given statement after the statement that contains this element.static void
addBeforeContainingStatement
(Commentable commentable, Statement statementToAdd) Adds the given statement before the statement that contains this element.static Interface
getAnnotationInterface
(Commentable commentable) Finds theInterface
representingjava.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 Class
getClassClass
(Commentable commentabke) Finds theClass
representingjava.lang.Class
.static ConcreteClassifier
getConcreteClassifier
(Commentable commentable, String name) Finds theConcreteClassifier
representing the class with the given classified name.static EList<ConcreteClassifier>
getConcreteClassifiers
(Commentable commentable, String packageName, String classifierQuery) Finds allConcreteClassifier
representing the classes in the given package or a single class from that package.static AnnotationInstance
getContainingAnnotationInstance
(Commentable commentable) Finds the containing annotation instance for the given element.static AnonymousClass
getContainingAnonymousClass
(Commentable commentable) Finds the containing anonymous class for the given element.static CompilationUnit
getContainingCompilationUnit
(Commentable commentable) Finds the containing compilation unit for the given element.static ConcreteClassifier
getContainingConcreteClassifier
(Commentable commentable) Finds the containing classifier for the given element.getContainingContainerName
(Commentable commentable) getContainingPackageName
(Commentable commentable) static EObject
getFirstChildByEType
(EObject eObject, EClassifier type) Searches for the first child with the given type.static <T> T
getFirstChildByType
(EObject eObject, Class<T> type) Searches for the first child with the given type.static Class
getLibClass
(Commentable commentable, String name) Finds theClass
representing the class with the given name located injava.lang
.static Interface
getLibInterface
(Commentable commentable, String name) Finds theInterface
representing the interface with the given name located injava.lang
.static Class
getObjectClass
(Commentable commentable) Finds theClass
representingjava.lang.Object
.static EObject
getParentByEType
(EObject eObject, EClassifier type) Walks up the containment hierarchy and returns the first parent with the given type.static <T> T
getParentByType
(EObject eObject, Class<T> type) Walks up the containment hierarchy and returns the first parent with the given type.static ConcreteClassifier
getParentConcreteClassifier
(Commentable commentable) Finds the classifier that is the parent of this element.static Class
getStringClass
(Commentable commentable) Finds theClass
representingjava.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,null
is returned. -
getFirstChildByType
Searches for the first child with the given type. If no such child is found,null
is returned. -
getChildrenByEType
Returns all children of the given type. -
getChildrenByType
Returns all children of the given type. -
getConcreteClassifier
Finds theConcreteClassifier
representing 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 allConcreteClassifier
representing 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 theClass
representing the class with the given name located injava.lang
.- Parameters:
commentable
- unusedname
- name of the Class.- Returns:
- the Class.
-
getLibInterface
Finds theInterface
representing the interface with the given name located injava.lang
.- Parameters:
commentable
- unusedname
- name of the Interface.- Returns:
- the interface.
-
getClassClass
Finds theClass
representingjava.lang.Class
.- Returns:
- the Class.
-
getObjectClass
Finds theClass
representingjava.lang.Object
.- Returns:
- the Class.
-
getStringClass
Finds theClass
representingjava.lang.String
.- Returns:
- the Class.
-
getAnnotationInterface
Finds theInterface
representingjava.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
-