Class JavaModelUtil


  • public class JavaModelUtil
    extends java.lang.Object
    * The JavaModelUtil class provides helper functions to access the given model.
    Author:
    fkreis (25.09.2014)
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaModelUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.Object> getAnnotations​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the model annotations-element (ModelConstant.ANNOTATIONS)
      static java.lang.String getCanonicalName​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the model's canonicalName element, which is the full qualified name of the input class
      static java.util.Map<java.lang.String,​java.lang.Object> getExtendedType​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the model's super type element
      static java.util.Map<java.lang.String,​java.lang.Object> getField​(java.util.Map<java.lang.String,​java.lang.Object> model, java.lang.String fieldName)
      Returns the field model with the given field name from model
      static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getFields​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the list of all field models (ModelConstant.FIELDS)
      static java.util.Map<java.lang.String,​java.lang.Object> getImplementedType​(java.util.Map<java.lang.String,​java.lang.Object> model, java.lang.String fqn)
      Returns the interface model for the given interface name if such an interface exists, otherwise null.
      static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getImplementedTypes​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the model's implemented types element, which is a list consisting of the interface models
      static java.util.Map<java.lang.String,​java.lang.Object> getJavaDocModel​(java.util.Map<java.lang.String,​java.lang.Object> documentedElementModel)
      Returns the JavaDoc model of the documented element model passed.
      static java.util.Map<java.lang.String,​java.lang.Object> getMethod​(java.util.Map<java.lang.String,​java.lang.Object> model, java.lang.String methodName)
      Returns the method model of the model with the given methodName.
      static java.util.Map<java.lang.String,​java.lang.Object> getMethodAccessibleField​(java.util.Map<java.lang.String,​java.lang.Object> model, java.lang.String fieldName)
      Returns the field model with the given field name from model
      static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getMethodAccessibleFields​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the list of all field models (ModelConstant.METHOD_ACCESSIBLE_FIELDS)
      static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getMethods​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the model's methods element, which is a list consisting of the method models
      static java.lang.String getName​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the model's name element, which is the simple name of the input class
      static java.util.Map<java.lang.String,​java.lang.Object> getRoot​(java.util.Map<java.lang.String,​java.lang.Object> model)
      Returns the model root-element (ModelConstant.MODEL_ROOT)
      • Methods inherited from class java.lang.Object

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

      • JavaModelUtil

        public JavaModelUtil()
    • Method Detail

      • getRoot

        public static java.util.Map<java.lang.String,​java.lang.Object> getRoot​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the model root-element (ModelConstant.MODEL_ROOT)
        Parameters:
        model - raw model
        Returns:
        the model root-element (ModelConstant.MODEL_ROOT)
      • getAnnotations

        public static java.util.Map<java.lang.String,​java.lang.Object> getAnnotations​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the model annotations-element (ModelConstant.ANNOTATIONS)
        Parameters:
        model - raw model
        Returns:
        the model annotations-element (ModelConstant.ANNOTATIONS)
      • getFields

        public static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getFields​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the list of all field models (ModelConstant.FIELDS)
        Parameters:
        model - raw model
        Returns:
        the list of all field models
      • getField

        public static java.util.Map<java.lang.String,​java.lang.Object> getField​(java.util.Map<java.lang.String,​java.lang.Object> model,
                                                                                      java.lang.String fieldName)
        Returns the field model with the given field name from model
        Parameters:
        model - raw model
        fieldName - field name to be retrieved
        Returns:
        the field model for the given field name if such a field exists, otherwise null.
      • getMethodAccessibleFields

        public static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getMethodAccessibleFields​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the list of all field models (ModelConstant.METHOD_ACCESSIBLE_FIELDS)
        Parameters:
        model - raw model
        Returns:
        the list of all field models
      • getMethodAccessibleField

        public static java.util.Map<java.lang.String,​java.lang.Object> getMethodAccessibleField​(java.util.Map<java.lang.String,​java.lang.Object> model,
                                                                                                      java.lang.String fieldName)
        Returns the field model with the given field name from model
        Parameters:
        model - raw model
        fieldName - field name to be retrieved
        Returns:
        the field model for the given field name if such a field exists, otherwise null.
      • getExtendedType

        public static java.util.Map<java.lang.String,​java.lang.Object> getExtendedType​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the model's super type element
        Parameters:
        model - raw model
        Returns:
        the model's super type element
      • getImplementedTypes

        public static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getImplementedTypes​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the model's implemented types element, which is a list consisting of the interface models
        Parameters:
        model - raw model
        Returns:
        the model's interfaces element
      • getImplementedType

        public static java.util.Map<java.lang.String,​java.lang.Object> getImplementedType​(java.util.Map<java.lang.String,​java.lang.Object> model,
                                                                                                java.lang.String fqn)
        Returns the interface model for the given interface name if such an interface exists, otherwise null.
        Parameters:
        model - raw model
        fqn - full qualified name, which identifies the specific interface
        Returns:
        the interface model
      • getMethods

        public static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getMethods​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the model's methods element, which is a list consisting of the method models
        Parameters:
        model - raw model
        Returns:
        the model's methods element
      • getMethod

        public static java.util.Map<java.lang.String,​java.lang.Object> getMethod​(java.util.Map<java.lang.String,​java.lang.Object> model,
                                                                                       java.lang.String methodName)
        Returns the method model of the model with the given methodName.
        Parameters:
        model - raw model
        methodName - method name to search for
        Returns:
        method model for the method with the given name or null if no method with the given name found.
      • getName

        public static java.lang.String getName​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the model's name element, which is the simple name of the input class
        Parameters:
        model - raw model
        Returns:
        the model's name element
      • getCanonicalName

        public static java.lang.String getCanonicalName​(java.util.Map<java.lang.String,​java.lang.Object> model)
        Returns the model's canonicalName element, which is the full qualified name of the input class
        Parameters:
        model - raw model
        Returns:
        the model's canonicalName element
      • getJavaDocModel

        public static java.util.Map<java.lang.String,​java.lang.Object> getJavaDocModel​(java.util.Map<java.lang.String,​java.lang.Object> documentedElementModel)
        Returns the JavaDoc model of the documented element model passed.
        Parameters:
        documentedElementModel - element model, from which the javaDoc model should be retrieved.
        Returns:
        the JavaDoc model or null if not available.