ptolemy.kernel.util
Class NameDuplicationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by ptolemy.kernel.util.KernelException
              extended by ptolemy.kernel.util.NameDuplicationException
All Implemented Interfaces:
java.io.Serializable

public class NameDuplicationException
extends KernelException

Thrown on an attempt to add a named object to a collection that requires unique names, and finding that there already is an object by that name in the collection. Constructors are provided that take 1 or 2 Nameable references plus an arbitrary String. The constructors are robust in that null references are ignored. The preferred constructors are those that take two named objects (the container and the would-be containee), or two named objects and an arbitrary string (which can be used to provide additional information about the error).

This class has no constructors that take a Throwable cause because no such constructors have been needed, but in principle, such constructors could be added if needed.

Since:
Ptolemy II 0.2
Version:
$Id: NameDuplicationException.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John S. Davis II, Edward A. Lee, Christopher Hylands
See Also:
Serialized Form
Accepted Rating:
Green (cxh)
Proposed Rating:
Green (cxh)

Constructor Summary
NameDuplicationException(Nameable container, Nameable wouldBeContainee)
          Construct an exception with a message that includes the name of the would be containee and the would be container.
NameDuplicationException(Nameable container, Nameable wouldBeContainee, java.lang.String detail)
          Construct an exception with a detail message that includes the name of the would be containee and the would be container plus the third argument string.
NameDuplicationException(Nameable container, java.lang.String detail)
          Construct an exception with a detail message that includes the name of the first argument.
 
Method Summary
 
Methods inherited from class ptolemy.kernel.util.KernelException
_setCause, _setMessage, generateMessage, generateMessage, generateMessage, getCause, getFullName, getMessage, getName, getNameable1, getNameable2, printStackTrace, printStackTrace, printStackTrace, stackTraceToString
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NameDuplicationException

public NameDuplicationException(Nameable container,
                                java.lang.String detail)
Construct an exception with a detail message that includes the name of the first argument. If one or more of the parameters are null, then the message of the exception is adjusted accordingly.

Parameters:
container - The would be container.
detail - The message.

NameDuplicationException

public NameDuplicationException(Nameable container,
                                Nameable wouldBeContainee)
Construct an exception with a message that includes the name of the would be containee and the would be container. If one or more of the parameters are null, then the message of the exception is adjusted accordingly.

Parameters:
wouldBeContainee - The would be containee.
container - The would be container.

NameDuplicationException

public NameDuplicationException(Nameable container,
                                Nameable wouldBeContainee,
                                java.lang.String detail)
Construct an exception with a detail message that includes the name of the would be containee and the would be container plus the third argument string. If one or more of the parameters are null, then the message of the exception is adjusted accordingly.

Parameters:
wouldBeContainee - The would be containee.
container - The would be container.
detail - A message.