com.ashridgetech.jamda.uml
Class StructuredType

java.lang.Object
  |
  +--com.ashridgetech.jamda.uml.ModelElement
        |
        +--com.ashridgetech.jamda.uml.Type
              |
              +--com.ashridgetech.jamda.uml.StructuredType
Direct Known Subclasses:
ClassType, InterfaceType

public abstract class StructuredType
extends Type

The base class for non-primitive UML types.

Version:
1.0
Author:
paulb

Nested Class Summary
static class StructuredType.Aggregation
          Typesafe enum to represent the aggregation of Association.Ends and Attributes in a type.
protected static class StructuredType.PropertyImpl
          Implementation of the Property interface for a getter and/or setter Operation.
static class StructuredType.Visibility
          Typesafe enum to represent the visibility of Operations and Attributes in a type.
 
Nested classes inherited from class com.ashridgetech.jamda.uml.ModelElement
ModelElement.DuplicateElementException, ModelElement.ElementListStore, ModelElement.ElementNameListStore, ModelElement.ElementNameStore, ModelElement.ElementStore, ModelElement.TaggedValue, ModelElement.UnknownElementException
 
Field Summary
static boolean READ_ONLY
           
static int UNBOUNDED
          Represents an unbounded multiplicity limit by a value of -1.
static boolean WRITABLE
           
 
Fields inherited from class com.ashridgetech.jamda.uml.ModelElement
DUMMY_STORE
 
Constructor Summary
protected StructuredType(ru.novosoft.uml.foundation.core.MClassifier mc, ModelPackage parentPackage)
          Initialises new StructuredType during loading.
 
Method Summary
 java.util.List addProperties(java.util.Collection newProperties, java.lang.Boolean isWritable)
          Add properties corresponding to a Collection of input properties.
 Property addProperty(java.lang.String name, Type type, boolean writable, java.lang.String comment, ModelElement source)
          Add a property to this StructuredType.
 Property addReadOnlyProperty(ModelElement source, java.lang.String name, Type type)
          Add a read-only property to this StructuredType.
 StructuredType addSuperType(StructuredType supertype)
          Add a StructuredType which is a supertype of this one, if there is one other than java.lang.Object.
 Property addWritableProperty(ModelElement source, java.lang.String name, Type type)
          Add a writable property to this StructuredType.
 void checkValid()
          Check whether this object is valid.
 java.util.List getAllProperties()
          Get the Propertys of this StructuredType and its supertypes.
 java.util.Collection getAllTaggedValues(TagDefinition tagDef)
          Get the tagged value(s) stored in this StructuredType and its supertypes under a certain TagDefinition.
 Operation getOperation(Stereotype stereotype, ModelElement element)
          Get the single Operation of this StructuredType with a given with a given Stereotype and the same original source as a given ModelElement.
 Operation getOperation(java.lang.String name)
          Get the single Operation of this StructuredType with a given name.
 java.util.List getOperations()
          Get the Operations of this StructuredType.
 java.util.List getOperations(ModelElement element)
          Get the Operation(s) of this StructuredType which have the same original source ModelElement as a given element, or whose direct source is the element.
 java.util.List getOperations(Stereotype stereotype)
          Get the Operation(s) of this StructuredType with a given Stereotype
 java.util.List getOperations(Stereotype stereotype, ModelElement source)
          Get the Operation(s) of this StructuredType with a given Stereotype and source ModelElement
 java.util.List getOperations(java.lang.String name)
          Get the Operation(s) of this StructuredType with a given name
 ModelPackage getParentPackage()
          Get the Package which contains this StructuredType.
 java.util.List getProperties()
          Get the Propertys of this StructuredType.
 Property getProperty(java.lang.String name)
          Get the single Property of this StructuredType with a given name.
protected  ModelElement.ElementStore getSubElementStore(java.lang.Class meClass)
          Overridden to return the sub-element ModelElement.ElementStore into which an object of the class meClass should be stored.
 java.util.Collection getSubTypes()
          Get the StructuredTypes which are subtypes of this one.
 java.util.Collection getSuperTypes()
          Get the StructuredTypes which are supertypes of this one.
 StructuredType.Visibility getVisibility()
          Get the visibility of this StructuredType.
(package private)  void invalidate(ModelElement changedObject)
          Inform this object that its cached details may be out of date.
 boolean isSimple()
          Show whether this Type is a simple type, such as a number or String , or composed of other parts.
protected  void load()
           
protected  java.util.List makeProperties()
          Creates Propertys for the getter and setter operations in this StructuredType.
protected  StructuredType.PropertyImpl makeProperty(Operation getter)
          Make one StructuredType.PropertyImpl from an Operation.
protected  StructuredType setStructuredTypeVisibility(StructuredType.Visibility visibility)
          Set the visibility of this StructuredType.
 
Methods inherited from class com.ashridgetech.jamda.uml.ModelElement
add, addStereotype, addTaggedValue, addTaggedValue, addTaggedValues, addTaggedValuesInternal, checkInitialised, checkState, findTaggedValueCollection, getBooleanTaggedValue, getChildElements, getComment, getDescription, getDirectSource, getElement, getElementType, getFullName, getId, getModel, getName, getNsElement, getOriginalSource, getParentElement, getProperties, getStereotypes, getStringTaggedValue, getTaggedValue, getTaggedValues, getXpathContext, hasStereotype, hasTaggedValue, init, initLoad, isInitialised, load, load, loadElement, logChange, logger, logger, logLoad, logLoadWarning, logNew, logWarning, removeTaggedValue, select, setComment, setDirectSource, setTaggedValue, setTaggedValue, setTaggedValue, setTaggedValues, stereotype, tag, tagError, toString, type, type, type, xpath, xpathList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READ_ONLY

public static final boolean READ_ONLY
See Also:
Constant Field Values

WRITABLE

public static final boolean WRITABLE
See Also:
Constant Field Values

UNBOUNDED

public static final int UNBOUNDED
Represents an unbounded multiplicity limit by a value of -1.

See Also:
Constant Field Values
Constructor Detail

StructuredType

protected StructuredType(ru.novosoft.uml.foundation.core.MClassifier mc,
                         ModelPackage parentPackage)
Initialises new StructuredType during loading.

Method Detail

getParentPackage

public ModelPackage getParentPackage()
Get the Package which contains this StructuredType.

Returns:
the Package

getVisibility

public StructuredType.Visibility getVisibility()
Get the visibility of this StructuredType.

Returns:
the visibility

setStructuredTypeVisibility

protected StructuredType setStructuredTypeVisibility(StructuredType.Visibility visibility)
Set the visibility of this StructuredType.

Parameters:
visibility - the new visibility - must not be null

getSuperTypes

public java.util.Collection getSuperTypes()
Get the StructuredTypes which are supertypes of this one.

Returns:
an unmodifiable list of StructuredType objects

addSuperType

public StructuredType addSuperType(StructuredType supertype)
Add a StructuredType which is a supertype of this one, if there is one other than java.lang.Object. A StructuredType which is already a supertype of this cannot be added again.

Parameters:
supertype - the supertype to add to this StructuredType - must not be null
Returns:
this instance
Throws:
java.lang.IllegalStateException - if supertype is already a supertype of this

addReadOnlyProperty

public Property addReadOnlyProperty(ModelElement source,
                                    java.lang.String name,
                                    Type type)
Add a read-only property to this StructuredType. Calls addProperty(java.lang.String, com.ashridgetech.jamda.uml.Type, boolean, java.lang.String, com.ashridgetech.jamda.uml.ModelElement).

Parameters:
name - the name of the property
type - the type of the property
Returns:
the set of features created for the property - see addProperty(java.lang.String, com.ashridgetech.jamda.uml.Type, boolean, java.lang.String, com.ashridgetech.jamda.uml.ModelElement)

addWritableProperty

public Property addWritableProperty(ModelElement source,
                                    java.lang.String name,
                                    Type type)
Add a writable property to this StructuredType. Calls addProperty(java.lang.String, com.ashridgetech.jamda.uml.Type, boolean, java.lang.String, com.ashridgetech.jamda.uml.ModelElement).

Parameters:
name - the name of the property
type - the type of the property
Returns:
the set of features created for the property - see addProperty(java.lang.String, com.ashridgetech.jamda.uml.Type, boolean, java.lang.String, com.ashridgetech.jamda.uml.ModelElement)

addProperty

public Property addProperty(java.lang.String name,
                            Type type,
                            boolean writable,
                            java.lang.String comment,
                            ModelElement source)
Add a property to this StructuredType.

Parameters:
name - the name of the property - must not be null or empty
type - the type of the property - must not be null
writable - true if the property is writable. Use the constants READ_ONLY and WRITABLE for clarity.
comment - the description of the property - if null, will use the comment from source, if that is not null
source - the source of this property - may be operations
Returns:
the set of features created for the property - Property.getSetter() will be null if writable is false, and Property.getAttribute() will always be null

addProperties

public java.util.List addProperties(java.util.Collection newProperties,
                                    java.lang.Boolean isWritable)
Add properties corresponding to a Collection of input properties.

Parameters:
newProperties - the Propertys that define the new ones to be added
Returns:
the new Propertys added

getSubTypes

public java.util.Collection getSubTypes()
Get the StructuredTypes which are subtypes of this one.

Returns:
an unmodifiable list of StructuredType objects

getProperties

public java.util.List getProperties()
Get the Propertys of this StructuredType. Calls makeProperties() the first time it is called.

Returns:
an unmodifiable list of objects which implement Property

getAllProperties

public java.util.List getAllProperties()
Get the Propertys of this StructuredType and its supertypes.

Returns:
an unmodifiable list of objects which implement Property

getProperty

public Property getProperty(java.lang.String name)
Get the single Property of this StructuredType with a given name. This implementation calls getProperties() to ensure the properties list is built.

Parameters:
name - the name of the required Property
Returns:
the Property whose name is name, or null if there is no Property with that name

getOperations

public java.util.List getOperations()
Get the Operations of this StructuredType.

Returns:
an unmodifiable list of Operation objects, in the order in which they are defined in the model.

getOperations

public java.util.List getOperations(java.lang.String name)
Get the Operation(s) of this StructuredType with a given name

Parameters:
name - the name of the required Operation(s)
Returns:
an unmodifiable list of the Operations whose name is name, which may be empty if there are no Operations with that name

getOperation

public Operation getOperation(java.lang.String name)
Get the single Operation of this StructuredType with a given name.

Parameters:
name - the name of the required Operation
Returns:
the Operation whose name is name, or null if there is no Operation with that name
Throws:
java.lang.IllegalStateException - if there is more than one Operation with name

getOperations

public java.util.List getOperations(Stereotype stereotype)
Get the Operation(s) of this StructuredType with a given Stereotype

Parameters:
stereotype - the stereotype of the required Operation(s)
Returns:
an unmodifiable list of the Operations whose stereotype is stereotype, which may be empty if there are no Operations with that stereotype

getOperations

public java.util.List getOperations(ModelElement element)
Get the Operation(s) of this StructuredType which have the same original source ModelElement as a given element, or whose direct source is the element.

Parameters:
element - the element for which the required Operation(s) are found - may not be null
Returns:
an unmodifiable list of the Operations found, which may be empty if there are no Operations with that source
See Also:
ModelElement.getOriginalSource(), ModelElement.getDirectSource()

getOperations

public java.util.List getOperations(Stereotype stereotype,
                                    ModelElement source)
Get the Operation(s) of this StructuredType with a given Stereotype and source ModelElement

Parameters:
stereotype - the stereotype of the required Operation(s)
source - the source element of the required Operation(s)
Returns:
an unmodifiable list of the Operations , which may be empty

getOperation

public Operation getOperation(Stereotype stereotype,
                              ModelElement element)
Get the single Operation of this StructuredType with a given with a given Stereotype and the same original source as a given ModelElement.

Parameters:
stereotype - the stereotype of the required Operation
element - the element with the same original source element as the required Operation
Returns:
the Operation found, or null if there is no Operation with the given source and stereotype
Throws:
java.lang.IllegalStateException - if there is more than one Operation with the given source and stereotype

getAllTaggedValues

public java.util.Collection getAllTaggedValues(TagDefinition tagDef)
Get the tagged value(s) stored in this StructuredType and its supertypes under a certain TagDefinition.

Parameters:
tagDef - the TagDefinition whose values are required
Returns:
an unmodifiable collection of Objects. If this element, and all its supertypes, do not have a tag corresponding to tagDef, returns an empty collection. If tagDef's TagDefinition.isReferenceType() method returns true, the collection contains the ModelElements referred to by the tagged values, otherwise the actual String or Boolean values.
See Also:
ModelElement.getTaggedValues(com.ashridgetech.jamda.uml.TagDefinition)

isSimple

public boolean isSimple()
Show whether this Type is a simple type, such as a number or String , or composed of other parts.

Specified by:
isSimple in class Type
Returns:
false as the default for StructuredType - this method may be overridden by subclasses

checkValid

public void checkValid()
                throws java.lang.IllegalStateException
Check whether this object is valid. Subclasses should call the superclass method if they override this method.

Overrides:
checkValid in class ModelElement
Throws:
java.lang.IllegalStateException - if a problem is found

makeProperties

protected java.util.List makeProperties()
Creates Propertys for the getter and setter operations in this StructuredType. May be overridden by subclasses to return a list of their ModelElements which implement the Property interface. An overriding method should call super.makeProperties and return a combined list.

Returns:
a List of Property objects

makeProperty

protected StructuredType.PropertyImpl makeProperty(Operation getter)
Make one StructuredType.PropertyImpl from an Operation.


getSubElementStore

protected ModelElement.ElementStore getSubElementStore(java.lang.Class meClass)
Overridden to return the sub-element ModelElement.ElementStore into which an object of the class meClass should be stored.

Overrides:
getSubElementStore in class ModelElement
Returns:
the store to use, or the superclass implementation if the class of the object is not stored by this class.

load

protected void load()
Overrides:
load in class ModelElement

invalidate

void invalidate(ModelElement changedObject)
Inform this object that its cached details may be out of date.

Parameters:
changedObject - the new or modified object which may affect this one


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.