Class KDMHelper

java.lang.Object
org.somox.kdmhelper.KDMHelper

public class KDMHelper extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    computeFullQualifiedName(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.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)
    static List<tools.mdsd.jamopp.model.java.members.Constructor>
    getConstructors(tools.mdsd.jamopp.model.java.types.Type implementingClass)
     
    static <T> T
    getFirstChildWithType(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.CompilationUnit
    getJavaNodeSourceRegion(tools.mdsd.jamopp.model.java.commons.Commentable node)
    For an ASTNode computes the JavaNodeSourceRegion object.
    static tools.mdsd.jamopp.model.java.members.Method
    getMethod(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 String
    getName(tools.mdsd.jamopp.model.java.types.PrimitiveType type)
     
    static String
    getName(tools.mdsd.jamopp.model.java.types.Type type)
     
    static EClass[]
     
    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.
    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 Object
    getPackage(tools.mdsd.jamopp.model.java.containers.Package element)
     
    static String
    getSISSyID(tools.mdsd.jamopp.model.java.commons.Commentable node)
    Returns a string representing the Commentable object.
    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.Package
    getSurroundingPackage(tools.mdsd.jamopp.model.java.types.Type input)
    Returns the surrounding package of a type, else null.
    static boolean
    isAbstract(tools.mdsd.jamopp.model.java.modifiers.AnnotableAndModifiable input)
    Returns whether the AnnotableAndModifiable object is abstract.
    static boolean
    isAccess(tools.mdsd.jamopp.model.java.commons.Commentable element)
     
    static boolean
    isInheritanceTypeAccess(tools.mdsd.jamopp.model.java.types.TypeReference inputTypeAccess)
    Checks if a type access is an inheritance type access.
    static boolean
    isInnerClass(tools.mdsd.jamopp.model.java.classifiers.ConcreteClassifier clazz)
    Returns if the type is an inner class.
    static boolean
    isInterface(tools.mdsd.jamopp.model.java.commons.Commentable input)
    Returns if the type is an interface.
    static boolean
    isPrimitive(tools.mdsd.jamopp.model.java.types.Type input)
    Returns whether the type is primitive or not.
    static boolean
    isVirtual(tools.mdsd.jamopp.model.java.members.Method method)
    A virtual method can be overridden.
    static String
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KDMHelper

      public KDMHelper()
  • Method Details

    • getName

      public static String getName(tools.mdsd.jamopp.model.java.types.Type type)
    • getName

      public static String getName(tools.mdsd.jamopp.model.java.types.PrimitiveType type)
    • computeFullQualifiedName

      public static String computeFullQualifiedName(tools.mdsd.jamopp.model.java.commons.Commentable astClass)
      Returns the qualified name for a type.
      Parameters:
      astClass - the ASTNode object
      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

      public static String removeLastPoint(String result)
    • 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 input Type
      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 an TagElement (for example in JavaDoc comments)
      are not in the result set.
      Parameters:
      input - an ASTNode object
      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 the JavaNodeSourceRegion object.
      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

      public static String getSISSyID(tools.mdsd.jamopp.model.java.commons.Commentable node)
      Returns a string representing the Commentable object.
      Parameters:
      node - the ASTNode object
      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 input ConcreteClassifier
      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 input Type
      Returns:
      the Package containing the type
    • isAbstract

      public static boolean isAbstract(tools.mdsd.jamopp.model.java.modifiers.AnnotableAndModifiable input)
      Returns whether the AnnotableAndModifiable object is abstract.
      Parameters:
      input - the Type object
      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 input Type
      Returns:
      true or false
    • getNewEClassEnumeration

      public static EClass[] 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 input Type
      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 - the BodyDeclaration object
      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

      public static Object getPackage(tools.mdsd.jamopp.model.java.containers.Package element)
    • 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)