Package org.somox.kdmhelper
Class KDMHelper
java.lang.Object
org.somox.kdmhelper.KDMHelper
This class contains a set of methods that are missing in the MoDisco Java meta model in
comparison to the SISSy G-AST meta model.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
computeFullQualifiedName
(org.emftext.language.java.commons.Commentable astClass) Returns the qualified name for a type.static List<org.emftext.language.java.types.Type>
getAllAccessedClasses
(org.emftext.language.java.types.Type input) Returns all accessed types inside a type.static List<org.emftext.language.java.types.TypeReference>
getAllAccesses
(org.emftext.language.java.commons.Commentable input) Returns all accesses inside an ASTNode object.static org.emftext.language.java.statements.StatementListContainer
getBody
(org.emftext.language.java.members.Member member) retruns the body of a method Since we use jamopp we return the class method itself since the ClassMethod is a StatementListContainer If the method is not a class method we just return an empty block (which is also a StatementListContainer)static List<org.emftext.language.java.members.Constructor>
getConstructors
(org.emftext.language.java.types.Type implementingClass) static <T> T
getFirstChildWithType
(org.emftext.language.java.commons.Commentable commentable, Class<T> classType) static List<org.emftext.language.java.types.ClassifierReference>
getInheritanceTypeAccesses
(org.emftext.language.java.classifiers.ConcreteClassifier concreteClassifier) static List<org.emftext.language.java.classifiers.ConcreteClassifier>
getInnerClasses
(org.emftext.language.java.classifiers.ConcreteClassifier clazz) For a type returns all inner classes.static org.emftext.language.java.containers.CompilationUnit
getJavaNodeSourceRegion
(org.emftext.language.java.commons.Commentable node) For an ASTNode computes theJavaNodeSourceRegion
object.static org.emftext.language.java.members.Method
getMethod
(org.emftext.language.java.references.MethodCall methodCall) static List<org.emftext.language.java.members.Method>
getMethods
(org.emftext.language.java.classifiers.ConcreteClassifier input) Returns all real methods (not constructors) of a type.static String
getName
(org.emftext.language.java.types.PrimitiveType type) static String
getName
(org.emftext.language.java.types.Type type) static EClass[]
static org.emftext.language.java.members.Method
getOverriddenASTNode
(org.emftext.language.java.members.Method methDecInput) Returns, if exist, the overridden member, else null.static Collection<org.emftext.language.java.containers.Package>
getOwnedElements
(org.emftext.language.java.containers.Package element) static EList<org.emftext.language.java.containers.Package>
getOwnedPackages
(org.emftext.language.java.containers.Package prefixPackage) static Object
getPackage
(org.emftext.language.java.containers.Package element) static String
getSISSyID
(org.emftext.language.java.commons.Commentable node) Returns a string representing theCommentable
object.static List<org.emftext.language.java.classifiers.ConcreteClassifier>
getSuperTypes
(org.emftext.language.java.classifiers.ConcreteClassifier concreteClassifier) Returns all super types of a type.static org.emftext.language.java.containers.Package
getSurroundingPackage
(org.emftext.language.java.types.Type input) Returns the surrounding package of a type, else null.static boolean
isAbstract
(org.emftext.language.java.modifiers.AnnotableAndModifiable input) Returns whether the AnnotableAndModifiable object is abstract.static boolean
isAccess
(org.emftext.language.java.commons.Commentable element) static boolean
isInheritanceTypeAccess
(org.emftext.language.java.types.TypeReference inputTypeAccess) Checks if a type access is an inheritance type access.static boolean
isInnerClass
(org.emftext.language.java.classifiers.ConcreteClassifier clazz) Returns if the type is an inner class.static boolean
isInterface
(org.emftext.language.java.commons.Commentable input) Returns if the type is an interface.static boolean
isPrimitive
(org.emftext.language.java.types.Type input) Returns whether the type is primitive or not.static boolean
isVirtual
(org.emftext.language.java.members.Method method) A virtual method can be overridden.static String
removeLastPoint
(String result)
-
Constructor Details
-
KDMHelper
public KDMHelper()
-
-
Method Details
-
getName
-
getName
-
computeFullQualifiedName
public static String computeFullQualifiedName(org.emftext.language.java.commons.Commentable astClass) Returns the qualified name for a type.- Parameters:
astClass
- theASTNode
object- Returns:
- the full qualified name of the input object
-
getMethod
public static org.emftext.language.java.members.Method getMethod(org.emftext.language.java.references.MethodCall methodCall) -
removeLastPoint
-
getAllAccessedClasses
public static List<org.emftext.language.java.types.Type> getAllAccessedClasses(org.emftext.language.java.types.Type input) Returns all accessed types inside a type.- Parameters:
input
- the inputType
- Returns:
- the list of accessed types
-
getAllAccesses
public static List<org.emftext.language.java.types.TypeReference> getAllAccesses(org.emftext.language.java.commons.Commentable input) Returns all accesses inside an ASTNode object.
Accesses inside anTagElement
(for example in JavaDoc comments)
are not in the result set.- Parameters:
input
- anASTNode
object- Returns:
- all accesses inside the ASTNode object
-
getInnerClasses
public static List<org.emftext.language.java.classifiers.ConcreteClassifier> getInnerClasses(org.emftext.language.java.classifiers.ConcreteClassifier clazz) For a type returns all inner classes.- Parameters:
clazz
- the input type- Returns:
- the list of inner classes
-
getJavaNodeSourceRegion
public static org.emftext.language.java.containers.CompilationUnit getJavaNodeSourceRegion(org.emftext.language.java.commons.Commentable node) For an ASTNode computes theJavaNodeSourceRegion
object.- Parameters:
node
- the ASTNode object- Returns:
- the
JavaNodeSourceRegion
-
getMethods
public static List<org.emftext.language.java.members.Method> getMethods(org.emftext.language.java.classifiers.ConcreteClassifier input) Returns all real methods (not constructors) of a type.- Parameters:
input
- the- Returns:
- the real methods (not constructors) of a Class
-
getOverriddenASTNode
public static org.emftext.language.java.members.Method getOverriddenASTNode(org.emftext.language.java.members.Method methDecInput) Returns, if exist, the overridden member, else null.- Parameters:
methDecInput
- the method object- Returns:
- the overridden method
-
getSISSyID
Returns a string representing theCommentable
object.- Parameters:
node
- theASTNode
object- Returns:
- the toString string of the input object
-
getSuperTypes
public static List<org.emftext.language.java.classifiers.ConcreteClassifier> getSuperTypes(org.emftext.language.java.classifiers.ConcreteClassifier concreteClassifier) Returns all super types of a type.- Parameters:
concreteClassifier
- the inputConcreteClassifier
- Returns:
- the list of super types
-
getSurroundingPackage
public static org.emftext.language.java.containers.Package getSurroundingPackage(org.emftext.language.java.types.Type input) Returns the surrounding package of a type, else null.- Parameters:
input
- the inputType
- Returns:
- the
Package
containing the type
-
isAbstract
public static boolean isAbstract(org.emftext.language.java.modifiers.AnnotableAndModifiable input) Returns whether the AnnotableAndModifiable object is abstract.- Parameters:
input
- theType
object- Returns:
- true or false
-
isAccess
public static boolean isAccess(org.emftext.language.java.commons.Commentable element) - Parameters:
element
-- Returns:
- true or false
-
isInheritanceTypeAccess
public static boolean isInheritanceTypeAccess(org.emftext.language.java.types.TypeReference inputTypeAccess) Checks if a type access is an inheritance type access.- Parameters:
inputTypeAccess
- The type access to verify.- Returns:
- true or false.
-
getInheritanceTypeAccesses
public static List<org.emftext.language.java.types.ClassifierReference> getInheritanceTypeAccesses(org.emftext.language.java.classifiers.ConcreteClassifier concreteClassifier) -
isInnerClass
public static boolean isInnerClass(org.emftext.language.java.classifiers.ConcreteClassifier clazz) Returns if the type is an inner class.- Parameters:
clazz
- the inputType
- Returns:
- true or false
-
getNewEClassEnumeration
-
isInterface
public static boolean isInterface(org.emftext.language.java.commons.Commentable input) Returns if the type is an interface.- Parameters:
input
- the input object- Returns:
- true or false
-
isPrimitive
public static boolean isPrimitive(org.emftext.language.java.types.Type input) Returns whether the type is primitive or not.- Parameters:
input
- the inputType
- Returns:
- true or false
-
isVirtual
public static boolean isVirtual(org.emftext.language.java.members.Method method) A virtual method can be overridden. In Java 1. Static methods cannot be overridden. 2. Non static private and final methods cannot be overridden.- Parameters:
method
- theBodyDeclaration
object- Returns:
- true or false
-
getBody
public static org.emftext.language.java.statements.StatementListContainer getBody(org.emftext.language.java.members.Member member) retruns the body of a method Since we use jamopp we return the class method itself since the ClassMethod is a StatementListContainer If the method is not a class method we just return an empty block (which is also a StatementListContainer)- Parameters:
member
-- Returns:
-
getOwnedPackages
public static EList<org.emftext.language.java.containers.Package> getOwnedPackages(org.emftext.language.java.containers.Package prefixPackage) -
getPackage
-
getOwnedElements
public static Collection<org.emftext.language.java.containers.Package> getOwnedElements(org.emftext.language.java.containers.Package element) -
getConstructors
public static List<org.emftext.language.java.members.Constructor> getConstructors(org.emftext.language.java.types.Type implementingClass) -
getFirstChildWithType
public static <T> T getFirstChildWithType(org.emftext.language.java.commons.Commentable commentable, Class<T> classType)
-