Class ObjectModelImpl

  • All Implemented Interfaces:
    WithTagValuesOrStereotypes, Model, ObjectModel

    @Component(role=Model.class,
               hint="objectmodel")
    public class ObjectModelImpl
    extends Object
    implements ObjectModel
    Implementation class for the root node abstraction of object model trees. This an entry point for browsing a model tree. This object offers as well several facilities for a direct access to some of the object model elements. In this concrete class, the tree is build by parsing an object model xml description using lutinxml XMLObjectParser. Created: 14 janv. 2004
    Author:
    Cédric Pineau - pineau@codelutin.com
    • Constructor Detail

      • ObjectModelImpl

        public ObjectModelImpl()
    • Method Detail

      • getModelType

        public String getModelType()
        Specified by:
        getModelType in interface Model
        Returns:
        the type of model.
      • setName

        public void setName​(String name)
      • setVersion

        public void setVersion​(String version)
      • getVersion

        public String getVersion()
        Description copied from interface: Model
        Returns the version of this model.
        Specified by:
        getVersion in interface Model
        Returns:
        the version of this model.
      • addComment

        public void addComment​(String comment)
      • getName

        public String getName()
        Returns the name of this model.
        Specified by:
        getName in interface Model
        Returns:
        the name of this model.
      • getPackage

        public ObjectModelPackage getPackage​(String packageName)
        Description copied from interface: ObjectModel
        Returns the package corresponding to the given name, or null if the model contains no package for this name.
        Specified by:
        getPackage in interface ObjectModel
        Parameters:
        packageName - - the name of the package to retrieve.
        Returns:
        the ObjectModelPackage of the found given name, or null if the model contains no package for this name.
      • getPackage

        public ObjectModelPackage getPackage​(ObjectModelClassifier classifier)
        Description copied from interface: ObjectModel
        Returns the package of the given classifier, or null if the model contains no package for this classifier.
        Specified by:
        getPackage in interface ObjectModel
        Parameters:
        classifier - the classifier of the package to retrieve.
        Returns:
        the ObjectModelPackage for the given classifier, or null if the model contains no package for this classifier.
      • hasPackage

        public boolean hasPackage​(String packageName)
        Description copied from interface: ObjectModel
        Indicates whether the model contains the package associated to the given name
        Specified by:
        hasPackage in interface ObjectModel
        Parameters:
        packageName - - the name of the package to retrieve.
        Returns:
        true if the package has been found.
      • getClassifier

        public ObjectModelClassifier getClassifier​(String qualifiedClassifierName)
        Returns the classifier corresponding to the given qualified name, or null if the model contains no classifier for this qualified name.
        Specified by:
        getClassifier in interface ObjectModel
        Parameters:
        qualifiedClassifierName - - the qualified name of the classifier to retrieve.
        Returns:
        the ObjectModelClassifier of the found classifier, or null if the model contains no classifier for this qualified name.
      • getClass

        public ObjectModelClass getClass​(String qualifiedClassName)
        Returns the class corresponding to the given qualified name, or null if the model contains no class for this qualified name.
        Specified by:
        getClass in interface ObjectModel
        Parameters:
        qualifiedClassName - - the qualified name of the class to retrieve.
        Returns:
        the ObjectModelClass of the found class, or null if the model contains no class for this qualified name.
      • hasClass

        public boolean hasClass​(String qualifiedClassName)
        Description copied from interface: ObjectModel
        Indicates whether the model contains the class associated to the given className
        Specified by:
        hasClass in interface ObjectModel
        Parameters:
        qualifiedClassName - - the qualified name of the class to retrieve.
        Returns:
        true if the class has been found.
      • getInterface

        public ObjectModelInterface getInterface​(String qualifiedInterfaceName)
        Returns the interface corresponding to the given qualified name, or null if the model contains no interface for this qualified name.
        Specified by:
        getInterface in interface ObjectModel
        Parameters:
        qualifiedInterfaceName - - the qualified name of the interface to retrieve.
        Returns:
        the ObjectModelInterface of the found interface, or null if the model contains no interface for this qualified name.
      • getEnumeration

        public ObjectModelEnumeration getEnumeration​(String qualifiedEnumerationName)
        Description copied from interface: ObjectModel
        Return the enumeration corresponding to the given qualified name
        Specified by:
        getEnumeration in interface ObjectModel
        Parameters:
        qualifiedEnumerationName - the fully qualified name of the enumeration to retrieve.
        Returns:
        the ObjectModelEnumeration of the found enumeration or null if the model contains no enumeration for this qualified name.
      • getComments

        public List<String> getComments()
        Returns all comments not lied to a particular model element
        Specified by:
        getComments in interface ObjectModel
        Returns:
        a List containing all comments for this model as Strings.
      • removePackage

        public void removePackage​(String packageName)
      • removeClass

        public void removeClass​(String className)
      • removeInterface

        public void removeInterface​(String interfaceName)
      • removeEnumeration

        public void removeEnumeration​(String enumerationName)
      • getTagValues

        public Map<String,​String> getTagValues()
        Description copied from interface: WithTagValuesOrStereotypes
        Returns the tagValues associated with this element. For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-)
        Specified by:
        getTagValues in interface WithTagValuesOrStereotypes
        Returns:
        a Map containing all tagValues associated with this element
      • getTagValue

        public String getTagValue​(String tagValue)
        Description copied from interface: WithTagValuesOrStereotypes
        Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name.
        Specified by:
        getTagValue in interface WithTagValuesOrStereotypes
        Parameters:
        tagValue - tag value key
        Returns:
        the value of the found tagValue, or null if the element has no associated tagValue for this name.
      • addTagValue

        public void addTagValue​(String tagValue,
                                String value)
        Description copied from interface: WithTagValuesOrStereotypes
        Adds the given value associated to the tagValue. Note: If a previous tag value was definied, then it will be replaced.
        Specified by:
        addTagValue in interface WithTagValuesOrStereotypes
        Parameters:
        tagValue - the name of the tag value
        value - the value to associate
      • hasTagValue

        public boolean hasTagValue​(String tagValue)
        Description copied from interface: WithTagValuesOrStereotypes
        Returns whether this element has a tagValue corresponding to the given name, or not.
        Specified by:
        hasTagValue in interface WithTagValuesOrStereotypes
        Parameters:
        tagValue - tag value name
        Returns:
        a boolean indicating whether this element has a tagValue corresponding to the given name, or not.
      • getExtension

        public <O> O getExtension​(String reference,
                                  Class<O> extensionClass)
                           throws RuntimeException
        Get the extension associated to the reference (unique). Create it if not exist.
        Specified by:
        getExtension in interface Model
        Type Parameters:
        O - object type returned
        Parameters:
        reference - unique corresponding to the extension to get
        extensionClass - class of the extension
        Returns:
        the object value for the extension
        Throws:
        ClassCastException - when extensionClass is not valid
        RuntimeException - when instantiation problem to create new extension