Class ModelUtils


  • public class ModelUtils
    extends java.lang.Object
    Some utilities on model side.
    Author:
    Holger Eichelberger
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ModelUtils.IModelFinder<M extends IModel,​E>
      A model finder for a certain model.
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static <M extends IModel,​E>
      E
      findElement​(M model, java.lang.String selectedElement, ModelUtils.IModelFinder<M,​E> finder, java.util.Set<M> done)
      Recursively finds an element also in the imports if not found in model.
      static <M extends IModel,​E>
      E
      getModelElement​(java.lang.String selectedElement, java.lang.String selectedElementsProjectName, ModelManagement<M> mgt, ModelUtils.IModelFinder<M,​E> finder)
      Tries to find a model element declaration for a given element name and a given project/model name.
      • Methods inherited from class java.lang.Object

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

      • DESC_VERSION_COMPARATOR

        private static final java.util.Comparator<VersionedModelInfos<?>> DESC_VERSION_COMPARATOR
    • Constructor Detail

      • ModelUtils

        public ModelUtils()
    • Method Detail

      • getModelElement

        public static <M extends IModel,​E> E getModelElement​(java.lang.String selectedElement,
                                                                   java.lang.String selectedElementsProjectName,
                                                                   ModelManagement<M> mgt,
                                                                   ModelUtils.IModelFinder<M,​E> finder)
        Tries to find a model element declaration for a given element name and a given project/model name. Handles imports.
        Type Parameters:
        E - the model element type
        M - the model type
        Parameters:
        selectedElement - the element name
        selectedElementsProjectName - the project/model name
        mgt - the model management instance
        finder - the element finder
        Returns:
        the declaration or null
      • findElement

        private static <M extends IModel,​E> E findElement​(M model,
                                                                java.lang.String selectedElement,
                                                                ModelUtils.IModelFinder<M,​E> finder,
                                                                java.util.Set<M> done)
        Recursively finds an element also in the imports if not found in model.
        Type Parameters:
        E - the model element type
        M - the model type
        Parameters:
        model - the model to search within
        selectedElement - the element name
        finder - the element finder
        done - already visited models for avoiding loops
        Returns:
        the found element or null