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(tools.mdsd.jamopp.model.java.commons.Commentable astClass) Returns the qualified name for a type.static List<tools.mdsd.jamopp.model.java.types.Type>getAllAccessedClasses(tools.mdsd.jamopp.model.java.types.Type input) Returns all accessed types inside a type.static List<tools.mdsd.jamopp.model.java.types.TypeReference>getAllAccesses(tools.mdsd.jamopp.model.java.commons.Commentable input) Returns all accesses inside an ASTNode object.static tools.mdsd.jamopp.model.java.statements.StatementListContainergetBody(tools.mdsd.jamopp.model.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<tools.mdsd.jamopp.model.java.members.Constructor>getConstructors(tools.mdsd.jamopp.model.java.types.Type implementingClass) static <T> TgetFirstChildWithType(tools.mdsd.jamopp.model.java.commons.Commentable commentable, Class<T> classType) static List<tools.mdsd.jamopp.model.java.types.ClassifierReference>getInheritanceTypeAccesses(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier concreteClassifier) static List<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier>getInnerClasses(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier clazz) For a type returns all inner classes.static tools.mdsd.jamopp.model.java.containers.CompilationUnitgetJavaNodeSourceRegion(tools.mdsd.jamopp.model.java.commons.Commentable node) For an ASTNode computes theJavaNodeSourceRegionobject.static tools.mdsd.jamopp.model.java.members.MethodgetMethod(tools.mdsd.jamopp.model.java.references.MethodCall methodCall) static List<tools.mdsd.jamopp.model.java.members.Method>getMethods(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier input) Returns all real methods (not constructors) of a type.static StringgetName(tools.mdsd.jamopp.model.java.types.PrimitiveType type) static StringgetName(tools.mdsd.jamopp.model.java.types.Type type) static EClass[]static tools.mdsd.jamopp.model.java.members.MethodgetOverriddenASTNode(tools.mdsd.jamopp.model.java.members.Method methDecInput) Returns, if exist, the overridden member, else null.static Collection<tools.mdsd.jamopp.model.java.containers.Package>getOwnedElements(tools.mdsd.jamopp.model.java.containers.Package element) static EList<tools.mdsd.jamopp.model.java.containers.Package>getOwnedPackages(tools.mdsd.jamopp.model.java.containers.Package prefixPackage) static ObjectgetPackage(tools.mdsd.jamopp.model.java.containers.Package element) static StringgetSISSyID(tools.mdsd.jamopp.model.java.commons.Commentable node) Returns a string representing theCommentableobject.static List<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier>getSuperTypes(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier concreteClassifier) Returns all super types of a type.static tools.mdsd.jamopp.model.java.containers.PackagegetSurroundingPackage(tools.mdsd.jamopp.model.java.types.Type input) Returns the surrounding package of a type, else null.static booleanisAbstract(tools.mdsd.jamopp.model.java.modifiers.AnnotableAndModifiable input) Returns whether the AnnotableAndModifiable object is abstract.static booleanisAccess(tools.mdsd.jamopp.model.java.commons.Commentable element) static booleanisInheritanceTypeAccess(tools.mdsd.jamopp.model.java.types.TypeReference inputTypeAccess) Checks if a type access is an inheritance type access.static booleanisInnerClass(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier clazz) Returns if the type is an inner class.static booleanisInterface(tools.mdsd.jamopp.model.java.commons.Commentable input) Returns if the type is an interface.static booleanisPrimitive(tools.mdsd.jamopp.model.java.types.Type input) Returns whether the type is primitive or not.static booleanisVirtual(tools.mdsd.jamopp.model.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(tools.mdsd.jamopp.model.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 tools.mdsd.jamopp.model.java.members.Method getMethod(tools.mdsd.jamopp.model.java.references.MethodCall methodCall) -
removeLastPoint
-
getAllAccessedClasses
public static List<tools.mdsd.jamopp.model.java.types.Type> getAllAccessedClasses(tools.mdsd.jamopp.model.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<tools.mdsd.jamopp.model.java.types.TypeReference> getAllAccesses(tools.mdsd.jamopp.model.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<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> getInnerClasses(tools.mdsd.jamopp.model.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 tools.mdsd.jamopp.model.java.containers.CompilationUnit getJavaNodeSourceRegion(tools.mdsd.jamopp.model.java.commons.Commentable node) For an ASTNode computes theJavaNodeSourceRegionobject.- Parameters:
node- the ASTNode object- Returns:
- the
JavaNodeSourceRegion
-
getMethods
public static List<tools.mdsd.jamopp.model.java.members.Method> getMethods(tools.mdsd.jamopp.model.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 tools.mdsd.jamopp.model.java.members.Method getOverriddenASTNode(tools.mdsd.jamopp.model.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<tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier> getSuperTypes(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier concreteClassifier) Returns all super types of a type.- Parameters:
concreteClassifier- the inputConcreteClassifier- Returns:
- the list of super types
-
getSurroundingPackage
public static tools.mdsd.jamopp.model.java.containers.Package getSurroundingPackage(tools.mdsd.jamopp.model.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(tools.mdsd.jamopp.model.java.modifiers.AnnotableAndModifiable input) Returns whether the AnnotableAndModifiable object is abstract.- Parameters:
input- theTypeobject- Returns:
- true or false
-
isAccess
public static boolean isAccess(tools.mdsd.jamopp.model.java.commons.Commentable element) - Parameters:
element-- Returns:
- true or false
-
isInheritanceTypeAccess
public static boolean isInheritanceTypeAccess(tools.mdsd.jamopp.model.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<tools.mdsd.jamopp.model.java.types.ClassifierReference> getInheritanceTypeAccesses(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier concreteClassifier) -
isInnerClass
public static boolean isInnerClass(tools.mdsd.jamopp.model.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(tools.mdsd.jamopp.model.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(tools.mdsd.jamopp.model.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(tools.mdsd.jamopp.model.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 tools.mdsd.jamopp.model.java.statements.StatementListContainer getBody(tools.mdsd.jamopp.model.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<tools.mdsd.jamopp.model.java.containers.Package> getOwnedPackages(tools.mdsd.jamopp.model.java.containers.Package prefixPackage) -
getPackage
-
getOwnedElements
public static Collection<tools.mdsd.jamopp.model.java.containers.Package> getOwnedElements(tools.mdsd.jamopp.model.java.containers.Package element) -
getConstructors
public static List<tools.mdsd.jamopp.model.java.members.Constructor> getConstructors(tools.mdsd.jamopp.model.java.types.Type implementingClass) -
getFirstChildWithType
public static <T> T getFirstChildWithType(tools.mdsd.jamopp.model.java.commons.Commentable commentable, Class<T> classType)
-