com.ashridgetech.jamda.uml
Class Attribute

java.lang.Object
  |
  +--com.ashridgetech.jamda.uml.ModelElement
        |
        +--com.ashridgetech.jamda.uml.Feature
              |
              +--com.ashridgetech.jamda.uml.Attribute
All Implemented Interfaces:
PropertyElement

public class Attribute
extends Feature
implements PropertyElement

A UML Attribute. Contained by ClassType.

Version:
1.0
Author:
paulb

Nested Class Summary
protected  class Attribute.PropertyImpl
          Inner class implementation of the Property interface for Attribute.
 
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 java.lang.String DEFAULT_OID_NAME
           
 
Fields inherited from class com.ashridgetech.jamda.uml.ModelElement
DUMMY_STORE
 
Constructor Summary
  Attribute(ClassType owner, java.lang.String name, Type type)
          Creates new Attribute belonging to a ClassType.
protected Attribute(ru.novosoft.uml.foundation.core.MAttribute ma, ClassType owner)
          Creates new Attribute from a NSUML MAttribute object during loading
 
Method Summary
 StructuredType.Aggregation getAggregation()
          Get the aggregation of this Attribute.
 java.lang.String getInitialValue()
          Get the initial value of this Attribute, or null if no initial value is specified.
 java.lang.String getMultName()
          Get the name of this Attribute , converted to plural using Util.pluralize(java.lang.String) if isMultiple() returns true.
 ClassType getOwner()
          Get the owner of this Attribute.
 Property getProperty()
          Get the representation of this Attribute as a Property.
 Type getType()
          Get the type of this Attribute.
 boolean isChangeable()
          Show whether this Attribute is changeable or frozen.
 boolean isMultiple()
          Indicate whether this property can have multiple values.
 boolean isOid()
          Indicate whether this Attribute is an object identifier (OID) for its StructuredType.
 boolean isReadable()
          Indicate whether the value(s) of this property can be read.
 boolean isWritable()
          Indicate whether the value(s) of this property can be written.
 boolean isWritableBy(Actor actor)
          Indicate whether the value(s) of this property can be written by a given Actor.
protected  Attribute setChangeable(boolean changeable)
          Set whether this Attribute is changeable or frozen.
 Attribute setInitialValue(java.lang.String initValue)
          Set the visibility of this Attribute.
 Attribute setStatic(boolean isStatic)
          Set whether this Attribute is of static scope.
 Attribute setVisibility(StructuredType.Visibility visibility)
          Set the visibility of this Attribute.
 
Methods inherited from class com.ashridgetech.jamda.uml.Feature
getReaders, getVisibility, getWriters, isReadableBy, isStatic, setFeatureStatic, setFeatureVisibility
 
Methods inherited from class com.ashridgetech.jamda.uml.ModelElement
add, addStereotype, addTaggedValue, addTaggedValue, addTaggedValues, addTaggedValuesInternal, checkInitialised, checkState, checkValid, findTaggedValueCollection, getBooleanTaggedValue, getChildElements, getComment, getDescription, getDirectSource, getElement, getElementType, getFullName, getId, getModel, getName, getNsElement, getOriginalSource, getParentElement, getProperties, getStereotypes, getStringTaggedValue, getSubElementStore, getTaggedValue, getTaggedValues, getXpathContext, hasStereotype, hasTaggedValue, init, initLoad, isInitialised, load, 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

DEFAULT_OID_NAME

public static final java.lang.String DEFAULT_OID_NAME
See Also:
Constant Field Values
Constructor Detail

Attribute

public Attribute(ClassType owner,
                 java.lang.String name,
                 Type type)
Creates new Attribute belonging to a ClassType.

Parameters:
owner - the owner of this Attribute
name - the name of this Attribute
type - the type of this Attribute

Attribute

protected Attribute(ru.novosoft.uml.foundation.core.MAttribute ma,
                    ClassType owner)
Creates new Attribute from a NSUML MAttribute object during loading

Method Detail

getOwner

public ClassType getOwner()
Get the owner of this Attribute.

Returns:
the ClassType to which this belongs
See Also:
ModelElement.getParentElement()

getType

public Type getType()
Get the type of this Attribute.

Returns:
the type

setStatic

public Attribute setStatic(boolean isStatic)
Set whether this Attribute is of static scope.

Parameters:
isStatic - true if this is to be static
Returns:
this object

isChangeable

public boolean isChangeable()
Show whether this Attribute is changeable or frozen.

Returns:
true if this is changeable, false if it is frozen

setChangeable

protected Attribute setChangeable(boolean changeable)
Set whether this Attribute is changeable or frozen.

Parameters:
changeable - true if this is to be changeable
Returns:
this object

isMultiple

public boolean isMultiple()
Indicate whether this property can have multiple values. Uses the rules of NSUtil.isMultiple(ru.novosoft.uml.foundation.data_types.MMultiplicity)

Returns:
true if multiple values are possible

getMultName

public java.lang.String getMultName()
Get the name of this Attribute , converted to plural using Util.pluralize(java.lang.String) if isMultiple() returns true.

Returns:
the singular or plural name as appropriate

isReadable

public boolean isReadable()
Indicate whether the value(s) of this property can be read.

Returns:
true if the values can be read

isWritable

public boolean isWritable()
Indicate whether the value(s) of this property can be written.

Returns:
true if the values can be updated

setVisibility

public Attribute setVisibility(StructuredType.Visibility visibility)
Set the visibility of this Attribute.

Parameters:
visibility - the Visibility instance representing this Attribute's visibility - must not be null
Returns:
this object

getAggregation

public StructuredType.Aggregation getAggregation()
Get the aggregation of this Attribute.

Returns:
StructuredType.Aggregation.COMPOSITE

getInitialValue

public java.lang.String getInitialValue()
Get the initial value of this Attribute, or null if no initial value is specified.

Returns:
the initial value expression

setInitialValue

public Attribute setInitialValue(java.lang.String initValue)
Set the visibility of this Attribute.

Parameters:
initValue - the new initial value expression - must not be null
Returns:
this object

isWritableBy

public boolean isWritableBy(Actor actor)
Indicate whether the value(s) of this property can be written by a given Actor. For this to be true, Feature.isWritableBy(com.ashridgetech.jamda.uml.Actor) must be true AND thisAttribute must be changeable

Overrides:
isWritableBy in class Feature
Returns:
true if the values can be written

isOid

public boolean isOid()
Indicate whether this Attribute is an object identifier (OID) for its StructuredType.

Returns:
true if the name is DEFAULT_OID_NAME

getProperty

public Property getProperty()
Get the representation of this Attribute as a Property.

Specified by:
getProperty in interface PropertyElement
Returns:
the Property for this Attribute - always the same instance


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.