org.eclipse.emf.edit.command
Class CommandParameter

java.lang.Object
  extended by org.eclipse.emf.edit.command.CommandParameter

public class CommandParameter
extends java.lang.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
 java.util.Collection<?> collection
          This is the collection of values involved in the command.
 java.lang.Object feature
          This is the aspect of the owner that will be affected.
 int index
          This the index (usually the position indicator) of the command.
static int NO_INDEX
          This value is used to indicate that the optional positional index indicator is unspecified.
 java.lang.Object owner
          This is the object that is the target or subject of the command.
 java.lang.Object value
          This is the single value involved in the command.
 
Constructor Summary
CommandParameter(java.lang.Object owner)
          This creates an instance specifying only an owner.
CommandParameter(java.lang.Object owner, java.lang.Object feature, java.util.Collection<?> collection)
          This creates an instance specifying an owner, a feature, and a collection of values.
CommandParameter(java.lang.Object owner, java.lang.Object feature, java.util.Collection<?> collection, int index)
          This creates an instance specifying an owner, a feature, a collection of values, and an index.
CommandParameter(java.lang.Object owner, java.lang.Object feature, java.lang.Object value)
          This creates an instance specifying an owner, a feature, and a value.
CommandParameter(java.lang.Object owner, java.lang.Object feature, java.lang.Object value, java.util.Collection<?> collection)
          This creates an instance specifying an owner, a feature, and a value, and a collection.
CommandParameter(java.lang.Object owner, java.lang.Object feature, java.lang.Object value, java.util.Collection<?> collection, int index)
          This creates an instance specifying an owner, a feature, a value, a collection, and an index.
CommandParameter(java.lang.Object owner, java.lang.Object feature, java.lang.Object value, int index)
          This creates an instance specifying an owner, a feature, a value, and an index.
 
Method Summary
static java.lang.String collectionToString(java.util.Collection<?> collection)
           
 java.util.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.
 java.lang.Object getFeature()
          This returns the specified feature.
 int getIndex()
          This returns the specified index.
 java.util.List<?> getList()
          This returns the specified collection as a list.
 java.lang.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.
 java.util.Collection<java.lang.String> getParameters()
          This yields an encoding of the owner-child relation.
 java.lang.Object getValue()
          This returns the specified value.
 void setOwner(java.lang.Object owner)
          This sets the owner to the specified value.
 java.lang.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 java.lang.Object owner
This is the object that is the target or subject of the command.


feature

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


collection

public java.util.Collection<?> collection
This is the collection of values involved in the command.


value

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


index

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

Constructor Detail

CommandParameter

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


CommandParameter

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


CommandParameter

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


CommandParameter

public CommandParameter(java.lang.Object owner,
                        java.lang.Object feature,
                        java.util.Collection<?> collection)
This creates an instance specifying an owner, a feature, and a collection of values.


CommandParameter

public CommandParameter(java.lang.Object owner,
                        java.lang.Object feature,
                        java.util.Collection<?> collection,
                        int index)
This creates an instance specifying an owner, a feature, a collection of values, and an index.


CommandParameter

public CommandParameter(java.lang.Object owner,
                        java.lang.Object feature,
                        java.lang.Object value,
                        java.util.Collection<?> collection)
This creates an instance specifying an owner, a feature, and a value, and a collection.


CommandParameter

public CommandParameter(java.lang.Object owner,
                        java.lang.Object feature,
                        java.lang.Object value,
                        java.util.Collection<?> collection,
                        int index)
This creates an instance specifying an owner, a feature, a value, a collection, and an index.

Method Detail

getOwner

public java.lang.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(java.lang.Object owner)
This sets the owner to the specified value.


getFeature

public java.lang.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 java.util.Collection<?> getCollection()
This returns the specified collection.


getList

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


getValue

public java.lang.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 java.util.Collection<java.lang.String> getParameters()
This yields an encoding of the owner-child relation.


collectionToString

public static java.lang.String collectionToString(java.util.Collection<?> collection)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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