com.bonevich.erj.model
Class Attribute

java.lang.Object
  |
  +--com.bonevich.erj.model.ModelElement
        |
        +--com.bonevich.erj.model.Attribute
All Implemented Interfaces:
ErjConstants

public final class Attribute
extends ModelElement

A class that represents an attribute of a relation (i.e. a column in a table). Attributes must have a type (which may be a predefined DataType or a user-defined Domain, both of which implement the AttributeType typing interface) and a constraint (NULL or NOTNULL as defined by AttributeConstraint). Attributes also may optionally have a default value and a set of associated keys.

Author:
Jeffrey D. Bonevich
See Also:
Relation, AttributeType, AttributeConstraint, KeyConstraint

Field Summary
static java.lang.String NEW_ATTRIBUTE_STR
           
 
Fields inherited from class com.bonevich.erj.model.ModelElement
_description, _dyn_description, _dyn_identifier, _dyn_name, _identifier, _name
 
Fields inherited from interface com.bonevich.erj.ErjConstants
EDITOR_COLOR, EDITOR_FONT, EMPTY_STR, ICON_AK, ICON_DOMAIN, ICON_FK, ICON_FOREIGNKEY, ICON_NOTNULL, ICON_NULL, ICON_PK, ICON_RELATION, ICON_SCHEMA, ICON_SPLASH, INITIAL_FRAME_SIZE, LABEL_COLOR, LABEL_FILL, LABEL_FONT, LABEL_FONT_ITALIC, LABEL_FONT_SIZE, LABEL_FONTMETRICS, STATUSBAR_COLOR, STATUSBAR_FONT, STATUSBAR_FONT_ITALIC, STATUSBAR_MOD_FILL, SUBLABEL_FILL
 
Constructor Summary
  Attribute()
          Default constructor needed for diagram loading.
  Attribute(Relation relation)
          Create a new attribute for a given Relation.
protected Attribute(Relation relation, Attribute that)
           
 
Method Summary
 void accept(ModelElementVisitor visitor)
           
 void addKey(KeyConstraint key)
           
 void dispose()
          Delete all keys of which this attribute is a member.
 boolean equals(java.lang.Object rhs)
           
 AttributeConstraint getConstraint()
           
 DefaultValue getDefaultValue()
           
 java.util.Iterator getKeyIterator()
           
 Relation getRelation()
           
 AttributeType getType()
           
 boolean isForeignKey()
           
 boolean isPrimaryKey()
           
 boolean isUniqueKey()
           
 void removeKey(KeyConstraint key)
           
 void setConstraint(AttributeConstraint constraint)
           
 void setDefaultValue(DefaultValue value)
           
 void setType(AttributeType type)
           
 
Methods inherited from class com.bonevich.erj.model.ModelElement
getDescription, getIdentifier, getName, getOclReferenceId, isNameInitialized, setDescription, setIdentifier, setName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NEW_ATTRIBUTE_STR

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

Attribute

public Attribute(Relation relation)
Create a new attribute for a given Relation. You should use Relation.createAttribute()


Attribute

protected Attribute(Relation relation,
                    Attribute that)

Attribute

public Attribute()
Default constructor needed for diagram loading.

Method Detail

getType

public AttributeType getType()

setType

public void setType(AttributeType type)

getDefaultValue

public DefaultValue getDefaultValue()

setDefaultValue

public void setDefaultValue(DefaultValue value)

setConstraint

public void setConstraint(AttributeConstraint constraint)

getConstraint

public AttributeConstraint getConstraint()

getRelation

public Relation getRelation()

addKey

public void addKey(KeyConstraint key)

removeKey

public void removeKey(KeyConstraint key)

getKeyIterator

public java.util.Iterator getKeyIterator()

isPrimaryKey

public boolean isPrimaryKey()

isUniqueKey

public boolean isUniqueKey()

isForeignKey

public boolean isForeignKey()

dispose

public void dispose()
Delete all keys of which this attribute is a member.

Specified by:
dispose in class ModelElement

equals

public boolean equals(java.lang.Object rhs)
Overrides:
equals in class ModelElement

accept

public void accept(ModelElementVisitor visitor)
Specified by:
accept in class ModelElement


Copyright © 2001-2003 bonevich.com. All Rights Reserved.