org.argouml.model.uml.foundation.extensionmechanisms
Class ExtensionMechanismsHelper

java.lang.Object
  |
  +--org.argouml.model.uml.foundation.extensionmechanisms.ExtensionMechanismsHelper

public class ExtensionMechanismsHelper
extends java.lang.Object

Helper class for UML Foundation::ExtensionMechanisms Package. Current implementation is a placeholder.

Since:
ARGO0.11.2

Field Summary
private static ExtensionMechanismsHelper SINGLETON
          Singleton instance.
 
Constructor Summary
private ExtensionMechanismsHelper()
          Don't allow instantiation.
 
Method Summary
 java.util.Collection getAllPossibleStereotypes(java.lang.Object modelElement)
          Returns all possible stereotypes for some modelelement.
static ExtensionMechanismsHelper getHelper()
          Singleton instance access method.
 java.lang.String getMetaModelName(MModelElement m)
           
 MStereotype getStereotype(MNamespace ns, MStereotype stereo)
          Finds a stereotype in some namespace.
 MStereotype getStereotype(MStereotype stereo)
          Searches the given stereotype in all models in the current project.
 java.util.Collection getStereotypes()
           
 java.util.Collection getStereotypes(MNamespace ns)
          Returns all stereotypes in a namespace.
 boolean isStereotype(java.lang.Object object, java.lang.String name, java.lang.String base)
          Tests if a stereotype is a stereotype with some name and base class.
 boolean isStereotypeInh(java.lang.Object object, java.lang.String name, java.lang.String base)
          Tests if a stereotype is or inherits from a stereotype with some name and base class.
protected  boolean isValidStereoType(java.lang.Class clazz, java.lang.Object stereo)
           
 boolean isValidStereoType(java.lang.Object m, java.lang.Object stereo)
          Returns true if the given stereotype has a baseclass that equals the baseclass of the given modelelement or one of the superclasses of the given modelelement.
 void setStereoType(java.lang.Object modelElement, java.lang.Object stereotype)
          Sets the stereotype of some modelelement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON

private static ExtensionMechanismsHelper SINGLETON
Singleton instance.

Constructor Detail

ExtensionMechanismsHelper

private ExtensionMechanismsHelper()
Don't allow instantiation.

Method Detail

getHelper

public static ExtensionMechanismsHelper getHelper()
Singleton instance access method.


getStereotypes

public java.util.Collection getStereotypes(MNamespace ns)
Returns all stereotypes in a namespace.

Parameters:
ns - is the namespace.
Returns:
a Collection with the stereotypes.

getStereotype

public MStereotype getStereotype(MNamespace ns,
                                 MStereotype stereo)
Finds a stereotype in some namespace. Returns null if no such stereotype is found.

Parameters:
ns - is the namespace.
stereo - is the stereotype.
Returns:
the stereotype found or null.

getStereotype

public MStereotype getStereotype(MStereotype stereo)
Searches the given stereotype in all models in the current project.

Parameters:
stereo - is the given stereotype
Returns:
MStereotype

getMetaModelName

public java.lang.String getMetaModelName(MModelElement m)

getAllPossibleStereotypes

public java.util.Collection getAllPossibleStereotypes(java.lang.Object modelElement)
Returns all possible stereotypes for some modelelement. Possible stereotypes are those stereotypes that are owned by the same namespace the modelelement is owned by and that have a baseclass that is the same as the metamodelelement name of the modelelement.

Parameters:
modelElement - is the model element
Returns:
Collection

isValidStereoType

protected boolean isValidStereoType(java.lang.Class clazz,
                                    java.lang.Object stereo)

isValidStereoType

public boolean isValidStereoType(java.lang.Object m,
                                 java.lang.Object stereo)
Returns true if the given stereotype has a baseclass that equals the baseclass of the given modelelement or one of the superclasses of the given modelelement.

Parameters:
m - is the model element
stereo - is the stereotype
Returns:
boolean

getStereotypes

public java.util.Collection getStereotypes()

setStereoType

public void setStereoType(java.lang.Object modelElement,
                          java.lang.Object stereotype)
Sets the stereotype of some modelelement. The method also copies a stereotype that is not a part of the current model to the current model.

Parameters:
modelElement - is the model element
stereotype - is the stereotype

isStereotype

public boolean isStereotype(java.lang.Object object,
                            java.lang.String name,
                            java.lang.String base)
Tests if a stereotype is a stereotype with some name and base class.

Parameters:
object - is the stereotype.
name - is the name of the stereotype.
base - is the base class of the stereotype.
Returns:
true if object is a stereotype with the desired characteristics.

isStereotypeInh

public boolean isStereotypeInh(java.lang.Object object,
                               java.lang.String name,
                               java.lang.String base)
Tests if a stereotype is or inherits from a stereotype with some name and base class.

Parameters:
object - is the stereotype.
name - is the name of the stereotype.
base - is the base class of the stereotype.
Returns:
true if object is a (descendant of a) stereotype with the desired characteristics.


ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook