org.eclipse.emf.edit.command
Class CommandParameter

java.lang.Object
  extended byorg.eclipse.emf.edit.command.CommandParameter

public class CommandParameter
extends Object

This is a convenient common base class for all the command parameters need by the various types of commands. It provides particular support for the encodings need by the basic EMF-based command implementations.


Field Summary
 Collection collection
          This is the collection of values involved in the command.
 Object feature
          This is the aspect of the owner that will be affected.
 int index
          This the index (ususally the position indicator) of the command.
static int NO_INDEX
          This value is used to indicate that the optional positional index indicator is unspecified.
 Object owner
          This is the object that is the target or subject of the command.
 Object value
          This is the single value involved in the command.
 
Constructor Summary
CommandParameter(Object owner)
          This creates an instance specifying only an owner.
CommandParameter(Object owner, Object feature, Collection collection)
          This creates an instance specifying an owner, a feature, and a collection of values.
CommandParameter(Object owner, Object feature, Collection collection, int index)
          This creates an instance specifying an owner, a feature, a collection of values, and an index.
CommandParameter(Object owner, Object feature, Object value)
          This creates an instance specifying an owner, a feature, and a value.
CommandParameter(Object owner, Object feature, Object value, Collection collection)
          This creates an instance specifying an owner, a feature, and a value, and a collection.
CommandParameter(Object owner, Object feature, Object value, Collection collection, int index)
          This creates an instance specifying an owner, a feature, a value, a collection, and an index.
CommandParameter(Object owner, Object feature, Object value, int index)
          This creates an instance specifying an owner, a feature, a value, and an index.
 
Method Summary
static String collectionToString(Collection collection)
           
 Collection getCollection()
          This returns the specified collection.
 EAttribute getEAttribute()
          This returns the specified feature as a EReference, if it is one.
 EObject getEOwner()
          This returns the specified owner as a EObject, if it is one.
 EReference getEReference()
          This returns the specified feature as a EReference, if it is one.
 EStructuralFeature getEStructuralFeature()
          This returns the specified feature as a EStructuralFeature, if it is one.
 EObject getEValue()
          This returns the specified value as a EObject, if it is one.
 Object getFeature()
          This returns the specified feature.
 int getIndex()
          This returns the specified index.
 List getList()
          This returns the specified collection as a list.
 Object getOwner()
          This returns the specified owner.
 EList getOwnerList()
          This is a safe way to get the list affected by the parameters for an add or remove specification.
 Collection getParameters()
          This yields an encoding of the owner-child relation.
 Object getValue()
          This returns the specified value.
 void setOwner(Object owner)
          This sets the owner to the specified value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_INDEX

public static final int NO_INDEX
This value is used to indicate that the optional positional index indicator is unspecified.

See Also:
Constant Field Values

owner

public Object owner
This is the object that is the target or subject of the command.


feature

public Object feature
This is the aspect of the owner that will be affected.


collection

public Collection collection
This is the collection of values involved in the command.


value

public Object value
This is the single value involved in the command.


index

public int index
This the index (ususally the position indicator) of the command.

Constructor Detail

CommandParameter

public CommandParameter(Object owner)
This creates an instance specifying only an owner.


CommandParameter

public CommandParameter(Object owner,
                        Object feature,
                        Object value)
This creates an instance specifying an owner, a feature, and a value.


CommandParameter

public CommandParameter(Object owner,
                        Object feature,
                        Object value,
                        int index)
This creates an instance specifying an owner, a feature, a value, and an index.


CommandParameter

public CommandParameter(Object owner,
                        Object feature,
                        Collection collection)
This creates an instance specifying an owner, a feature, and a collection of values.


CommandParameter

public CommandParameter(Object owner,
                        Object feature,
                        Collection collection,
                        int index)
This creates an instance specifying an owner, a feature, a collection of values, and an index.


CommandParameter

public CommandParameter(Object owner,
                        Object feature,
                        Object value,
                        Collection collection)
This creates an instance specifying an owner, a feature, and a value, and a collection.


CommandParameter

public CommandParameter(Object owner,
                        Object feature,
                        Object value,
                        Collection collection,
                        int index)
This creates an instance specifying an owner, a feature, a value, a collection, and an index.

Method Detail

getOwner

public Object getOwner()
This returns the specified owner.


getEOwner

public EObject getEOwner()
This returns the specified owner as a EObject, if it is one.


setOwner

public void setOwner(Object owner)
This sets the owner to the specified value.


getFeature

public Object getFeature()
This returns the specified feature.


getEStructuralFeature

public EStructuralFeature getEStructuralFeature()
This returns the specified feature as a EStructuralFeature, if it is one.


getEReference

public EReference getEReference()
This returns the specified feature as a EReference, if it is one.


getEAttribute

public EAttribute getEAttribute()
This returns the specified feature as a EReference, if it is one.


getOwnerList

public EList getOwnerList()
This is a safe way to get the list affected by the parameters for an add or remove specification. It can return either the EList, if the owner is one, or it tries to get the EList specified by the feature of the owner.

It works as an excellent guard for poorly formed parameters.


getCollection

public Collection getCollection()
This returns the specified collection.


getList

public List getList()
This returns the specified collection as a list. If the collection isn't a list, a new copy is created.


getValue

public Object getValue()
This returns the specified value.


getEValue

public EObject getEValue()
This returns the specified value as a EObject, if it is one.


getIndex

public int getIndex()
This returns the specified index.


getParameters

public Collection getParameters()
This yields an encoding of the owner-child relation.


collectionToString

public static String collectionToString(Collection collection)

toString

public String toString()

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.