net.sourceforge.nrl.parser.model
Class AbstractModelElement

java.lang.Object
  extended by net.sourceforge.nrl.parser.model.AbstractModelElement
All Implemented Interfaces:
IModelElement
Direct Known Subclasses:
AbstractClassifier, AbstractPackage

public abstract class AbstractModelElement
extends Object
implements IModelElement

Basic abstract implementation of a model element that manages the name and parent. Subclasses provide further details.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sourceforge.nrl.parser.model.IModelElement
IModelElement.ElementType
 
Constructor Summary
AbstractModelElement(String name, IPackage container)
           
 
Method Summary
 void addChild(IModelElement child)
           
 IPackage getContainingPackage()
          Return the package containing this model element
 List<IModelElement> getDescendants(boolean transitive)
          Return a list of elements that inherit fromm this.
 String getName()
          Return the model element's name.
 String getOriginalName()
          Some elements have to be renamed on loading.
 IModelElement getParent()
          Return the parent, if there is an inheritance relationship, or null if none.
 String getQualifiedName()
          Return a fully qualified name for this element, listing all the package it is contained in.
 Object getUserData(String key)
          Return user data stored on this model element.
 boolean isAssignableFrom(IModelElement other)
          Return true if the model element can be assigned the value of another in an expression.
 boolean isSupplementary()
          Returns a flag indicating whether the element is a supplementary element loaded from a type library or dependent model.
 void setName(String name)
           
 void setOriginalName(String name)
           
 void setParent(IModelElement parent)
           
 void setSupplementary(boolean supplementary)
           
 void setUserData(String key, Object data)
          Set user data to be stored on this model element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.nrl.parser.model.IModelElement
getDocumentation, getElementType
 

Constructor Detail

AbstractModelElement

public AbstractModelElement(String name,
                            IPackage container)
Method Detail

addChild

public void addChild(IModelElement child)

getContainingPackage

public IPackage getContainingPackage()
Description copied from interface: IModelElement
Return the package containing this model element

Specified by:
getContainingPackage in interface IModelElement
Returns:
the package

getName

public String getName()
Description copied from interface: IModelElement
Return the model element's name.

Specified by:
getName in interface IModelElement
Returns:
the name

getParent

public IModelElement getParent()
Description copied from interface: IModelElement
Return the parent, if there is an inheritance relationship, or null if none.

Specified by:
getParent in interface IModelElement
Returns:
the parent or null

getDescendants

public List<IModelElement> getDescendants(boolean transitive)
Description copied from interface: IModelElement
Return a list of elements that inherit fromm this.

Specified by:
getDescendants in interface IModelElement
Parameters:
transitive - if true, return children of children recursively
Returns:
the children, may be an empty list

getOriginalName

public String getOriginalName()
Description copied from interface: IModelElement
Some elements have to be renamed on loading. For example, XML schema elements or UML classes that have a dot in them have their dots stripped out by the NRL model loader, otherwise they cannot be used. In these cases, this method will return the original name found in the model.

In all other cases, the method returns the same as IModelElement.getName().

Specified by:
getOriginalName in interface IModelElement
Returns:
the original name

getQualifiedName

public String getQualifiedName()
Description copied from interface: IModelElement
Return a fully qualified name for this element, listing all the package it is contained in.

Specified by:
getQualifiedName in interface IModelElement
Returns:
the fully qualified name

getUserData

public Object getUserData(String key)
Description copied from interface: IModelElement
Return user data stored on this model element. This can be used to attach and retrieve processing information.

Specified by:
getUserData in interface IModelElement
Parameters:
key - the key under which the data is stored
Returns:
the data or null if not present

isAssignableFrom

public boolean isAssignableFrom(IModelElement other)
Description copied from interface: IModelElement
Return true if the model element can be assigned the value of another in an expression. In a typical object-oriented model, any superclass is assignable from subclass objects, but not the other way round.

Specified by:
isAssignableFrom in interface IModelElement
Parameters:
other - the assigned object
Returns:
true if the object can be assigned

isSupplementary

public boolean isSupplementary()
Description copied from interface: IModelElement
Returns a flag indicating whether the element is a supplementary element loaded from a type library or dependent model. This is necessary to distinguish primary business model types from those loaded from the UML2 type library, HyperModel or other sources.

Specified by:
isSupplementary in interface IModelElement
Returns:
true if the element is supplementary

setName

public void setName(String name)

setOriginalName

public void setOriginalName(String name)

setParent

public void setParent(IModelElement parent)

setSupplementary

public void setSupplementary(boolean supplementary)

setUserData

public void setUserData(String key,
                        Object data)
Description copied from interface: IModelElement
Set user data to be stored on this model element. This can be used to attach and retrieve processing information.

Specified by:
setUserData in interface IModelElement
Parameters:
key - the key under which the data is stored
data - the data


Copyright © 2006-2010 Christian Nentwich and others