Class ObjectModelImpl
- java.lang.Object
-
- org.nuiton.eugene.models.object.xml.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
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,ObjectModelClass>classesprotected Map<String,ObjectModelClassifier>classifiersprotected List<String>commentsprotected Map<String,ObjectModelEnumeration>enumerationsprotected Map<String,ObjectModelInterface>interfacesprotected Stringnameprotected Map<String,ObjectModelPackage>packagesprotected Map<String,String>tagValuesprotected Stringversion-
Fields inherited from interface org.nuiton.eugene.models.object.ObjectModel
NAME
-
-
Constructor Summary
Constructors Constructor Description ObjectModelImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAssociationClass(ObjectModelAssociationClassImpl clazz)voidaddClass(ObjectModelClassImpl clazz)voidaddComment(String comment)voidaddEnumeration(ObjectModelEnumerationImpl enumeration)voidaddInterface(ObjectModelInterfaceImpl interfacez)voidaddPackage(ObjectModelPackageImpl aPackage)voidaddStereotype(String stereotype)voidaddTagValue(String tagValue, String value)Adds the givenvalueassociated to thetagValue.ObjectModelImplTagValueaddTagValue(ObjectModelImplTagValue tagValue)ObjectModelClassgetClass(String qualifiedClassName)Returns the class corresponding to the given qualified name, or null if the model contains no class for this qualified name.Collection<ObjectModelClass>getClasses()Returns all classes defined in this model.ObjectModelClassifiergetClassifier(String qualifiedClassifierName)Returns the classifier corresponding to the given qualified name, or null if the model contains no classifier for this qualified name.Collection<ObjectModelClassifier>getClassifiers()Returns all classifiers defined in this model.List<String>getComments()Returns all comments not lied to a particular model elementObjectModelEnumerationgetEnumeration(String qualifiedEnumerationName)Return the enumeration corresponding to the given qualified nameCollection<ObjectModelEnumeration>getEnumerations()Returns all enumerations defined in this model.<O> OgetExtension(String reference, Class<O> extensionClass)Get the extension associated to the reference (unique).ObjectModelInterfacegetInterface(String qualifiedInterfaceName)Returns the interface corresponding to the given qualified name, or null if the model contains no interface for this qualified name.Collection<ObjectModelInterface>getInterfaces()Returns all interfaces defined in this model.StringgetModelType()StringgetName()Returns the name of this model.ObjectModelPackagegetPackage(String packageName)Returns the package corresponding to the given name, or null if the model contains no package for this name.ObjectModelPackagegetPackage(ObjectModelClassifier classifier)Returns the package of the given classifier, or null if the model contains no package for this classifier.Collection<ObjectModelPackage>getPackages()Returns all packages defined in this model.Set<String>getStereotypes()StringgetTagValue(String tagValue)Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name.Map<String,String>getTagValues()Returns the tagValues associated with this element.ObjectModelTagValuesStoregetTagValuesStore()StringgetVersion()Returns the version of this model.booleanhasClass(String qualifiedClassName)Indicates whether the model contains the class associated to the given classNamebooleanhasPackage(String packageName)Indicates whether the model contains the package associated to the given namebooleanhasStereotype(String stereotypeName)booleanhasTagValue(String tagValue)Returns whether this element has a tagValue corresponding to the given name, or not.protected voidmergeClassifiers(ObjectModelClassifierImpl initialClazzifier, ObjectModelClassifierImpl additionalClazzifier)protected voidmergePackages(ObjectModelPackageImpl initialPackage, ObjectModelPackageImpl additionalPackage)voidremoveClass(String className)voidremoveEnumeration(String enumerationName)voidremoveInterface(String interfaceName)voidremovePackage(String packageName)voidremoveStereotype(String stereotype)voidremoveTagValue(String tagvalue)voidsetName(String name)voidsetVersion(String version)
-
-
-
Field Detail
-
name
protected String name
-
version
protected String version
-
classes
protected Map<String,ObjectModelClass> classes
-
packages
protected Map<String,ObjectModelPackage> packages
-
interfaces
protected Map<String,ObjectModelInterface> interfaces
-
classifiers
protected Map<String,ObjectModelClassifier> classifiers
-
enumerations
protected Map<String,ObjectModelEnumeration> enumerations
-
-
Method Detail
-
getTagValuesStore
public ObjectModelTagValuesStore getTagValuesStore()
- Specified by:
getTagValuesStorein interfaceObjectModel- Returns:
- the new object to query tag values on any element of this model.
-
getModelType
public String getModelType()
- Specified by:
getModelTypein interfaceModel- 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:ModelReturns the version of this model.- Specified by:
getVersionin interfaceModel- Returns:
- the version of this model.
-
addPackage
public void addPackage(ObjectModelPackageImpl aPackage)
-
addClass
public void addClass(ObjectModelClassImpl clazz)
-
addAssociationClass
public void addAssociationClass(ObjectModelAssociationClassImpl clazz)
-
addComment
public void addComment(String comment)
-
getName
public String getName()
Returns the name of this model.
-
getPackages
public Collection<ObjectModelPackage> getPackages()
Description copied from interface:ObjectModelReturns all packages defined in this model.- Specified by:
getPackagesin interfaceObjectModel- Returns:
- a Collection containing all ObjectModelPackage for this model.
- See Also:
ObjectModelPackage
-
getPackage
public ObjectModelPackage getPackage(String packageName)
Description copied from interface:ObjectModelReturns the package corresponding to the given name, or null if the model contains no package for this name.- Specified by:
getPackagein interfaceObjectModel- 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:ObjectModelReturns the package of the given classifier, or null if the model contains no package for this classifier.- Specified by:
getPackagein interfaceObjectModel- 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:ObjectModelIndicates whether the model contains the package associated to the given name- Specified by:
hasPackagein interfaceObjectModel- Parameters:
packageName- - the name of the package to retrieve.- Returns:
- true if the package has been found.
-
getClassifiers
public Collection<ObjectModelClassifier> getClassifiers()
Returns all classifiers defined in this model.- Specified by:
getClassifiersin interfaceObjectModel- Returns:
- a Collection containing all ObjectModelClassifier for this model.
- See Also:
ObjectModelClassifier
-
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:
getClassifierin interfaceObjectModel- 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.
-
getClasses
public Collection<ObjectModelClass> getClasses()
Returns all classes defined in this model.- Specified by:
getClassesin interfaceObjectModel- Returns:
- a Collection containing all ObjectModelClass for this model.
- See Also:
ObjectModelClass
-
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:
getClassin interfaceObjectModel- 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:ObjectModelIndicates whether the model contains the class associated to the given className- Specified by:
hasClassin interfaceObjectModel- Parameters:
qualifiedClassName- - the qualified name of the class to retrieve.- Returns:
- true if the class has been found.
-
addInterface
public void addInterface(ObjectModelInterfaceImpl interfacez)
-
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:
getInterfacein interfaceObjectModel- 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.
-
getInterfaces
public Collection<ObjectModelInterface> getInterfaces()
Returns all interfaces defined in this model.- Specified by:
getInterfacesin interfaceObjectModel- Returns:
- a Collection containing all ObjectModelInterface for this model.
- See Also:
ObjectModelInterface
-
addEnumeration
public void addEnumeration(ObjectModelEnumerationImpl enumeration)
-
getEnumerations
public Collection<ObjectModelEnumeration> getEnumerations()
Description copied from interface:ObjectModelReturns all enumerations defined in this model.- Specified by:
getEnumerationsin interfaceObjectModel- Returns:
- a Collection containing all ObjectModelEnumeration for this model.
- See Also:
ObjectModelEnumeration
-
getEnumeration
public ObjectModelEnumeration getEnumeration(String qualifiedEnumerationName)
Description copied from interface:ObjectModelReturn the enumeration corresponding to the given qualified name- Specified by:
getEnumerationin interfaceObjectModel- 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:
getCommentsin interfaceObjectModel- Returns:
- a List containing all comments for this model as Strings.
-
getStereotypes
public Set<String> getStereotypes()
- Specified by:
getStereotypesin interfaceWithTagValuesOrStereotypes
-
hasStereotype
public boolean hasStereotype(String stereotypeName)
- Specified by:
hasStereotypein interfaceWithTagValuesOrStereotypes
-
addStereotype
public void addStereotype(String stereotype)
- Specified by:
addStereotypein interfaceWithTagValuesOrStereotypes
-
removeStereotype
public void removeStereotype(String stereotype)
- Specified by:
removeStereotypein interfaceWithTagValuesOrStereotypes
-
removePackage
public void removePackage(String packageName)
-
removeClass
public void removeClass(String className)
-
removeInterface
public void removeInterface(String interfaceName)
-
removeEnumeration
public void removeEnumeration(String enumerationName)
-
mergePackages
protected void mergePackages(ObjectModelPackageImpl initialPackage, ObjectModelPackageImpl additionalPackage)
-
mergeClassifiers
protected void mergeClassifiers(ObjectModelClassifierImpl initialClazzifier, ObjectModelClassifierImpl additionalClazzifier)
-
addTagValue
public ObjectModelImplTagValue addTagValue(ObjectModelImplTagValue tagValue)
-
getTagValues
public Map<String,String> getTagValues()
Description copied from interface:WithTagValuesOrStereotypesReturns 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:
getTagValuesin interfaceWithTagValuesOrStereotypes- Returns:
- a Map containing all tagValues associated with this element
-
getTagValue
public String getTagValue(String tagValue)
Description copied from interface:WithTagValuesOrStereotypesReturns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name.- Specified by:
getTagValuein interfaceWithTagValuesOrStereotypes- 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:WithTagValuesOrStereotypesAdds the givenvalueassociated to thetagValue. Note: If a previous tag value was definied, then it will be replaced.- Specified by:
addTagValuein interfaceWithTagValuesOrStereotypes- Parameters:
tagValue- the name of the tag valuevalue- the value to associate
-
hasTagValue
public boolean hasTagValue(String tagValue)
Description copied from interface:WithTagValuesOrStereotypesReturns whether this element has a tagValue corresponding to the given name, or not.- Specified by:
hasTagValuein interfaceWithTagValuesOrStereotypes- Parameters:
tagValue- tag value name- Returns:
- a boolean indicating whether this element has a tagValue corresponding to the given name, or not.
-
removeTagValue
public void removeTagValue(String tagvalue)
- Specified by:
removeTagValuein interfaceWithTagValuesOrStereotypes
-
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:
getExtensionin interfaceModel- Type Parameters:
O- object type returned- Parameters:
reference- unique corresponding to the extension to getextensionClass- class of the extension- Returns:
- the object value for the extension
- Throws:
ClassCastException- when extensionClass is not validRuntimeException- when instantiation problem to create new extension
-
-