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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomputeFullQualifiedName(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.StatementListContainergetBody(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> TgetFirstChildWithType(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.CompilationUnitgetJavaNodeSourceRegion(org.emftext.language.java.commons.Commentable node) For an ASTNode computes theJavaNodeSourceRegionobject.static org.emftext.language.java.members.MethodgetMethod(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 StringgetName(org.emftext.language.java.types.PrimitiveType type) static StringgetName(org.emftext.language.java.types.Type type) static EClass[]static org.emftext.language.java.members.MethodgetOverriddenASTNode(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 ObjectgetPackage(org.emftext.language.java.containers.Package element) static StringgetSISSyID(org.emftext.language.java.commons.Commentable node) Returns a string representing theCommentableobject.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.PackagegetSurroundingPackage(org.emftext.language.java.types.Type input) Returns the surrounding package of a type, else null.static booleanisAbstract(org.emftext.language.java.modifiers.AnnotableAndModifiable input) Returns whether the AnnotableAndModifiable object is abstract.static booleanisAccess(org.emftext.language.java.commons.Commentable element) static booleanisInheritanceTypeAccess(org.emftext.language.java.types.TypeReference inputTypeAccess) Checks if a type access is an inheritance type access.static booleanisInnerClass(org.emftext.language.java.classifiers.ConcreteClassifier clazz) Returns if the type is an inner class.static booleanisInterface(org.emftext.language.java.commons.Commentable input) Returns if the type is an interface.static booleanisPrimitive(org.emftext.language.java.types.Type input) Returns whether the type is primitive or not.static booleanisVirtual(org.emftext.language.java.members.Method method) A virtual method can be overridden.static StringremoveLastPoint(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- theASTNodeobject- 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- anASTNodeobject- 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 theJavaNodeSourceRegionobject.- 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 theCommentableobject.- Parameters:
node- theASTNodeobject- 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
Packagecontaining the type
-
isAbstract
public static boolean isAbstract(org.emftext.language.java.modifiers.AnnotableAndModifiable input) Returns whether the AnnotableAndModifiable object is abstract.- Parameters:
input- theTypeobject- 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- theBodyDeclarationobject- 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)
-