org.infoglue.cms.util
Class ConstraintExceptionBuffer

java.lang.Object
  extended by org.infoglue.cms.util.ConstraintExceptionBuffer
Direct Known Subclasses:
AccessConstraintExceptionBuffer

public class ConstraintExceptionBuffer
extends java.lang.Object

Any duplicate (ConstraintException.equals()) will be silently discarded.

Author:
Patrik Nyborg

Field Summary
protected  java.util.Set exceptions
           
 
Constructor Summary
ConstraintExceptionBuffer()
          Constructs a ConstraintExceptionBuffer with no exceptions in it.
ConstraintExceptionBuffer(ConstraintException exception)
          Constructs a ConstraintExceptionBuffer containing the specified exception(s).
 
Method Summary
 void add(ConstraintException exception)
          Adds the specified exception to the exceptions of this buffer.
 void add(ConstraintExceptionBuffer ceb)
          Adds the exceptions of the specified buffer to this buffer.
 boolean equals(java.lang.Object o)
          Returns true if the specified object is a buffer containing exactly the same exceptions as this one.
 int hashCode()
          Note!
 boolean isEmpty()
          Returns true if this buffer contains no exceptions; false otherwise.
 void throwIfNotEmpty()
          Throws the root exception; if this buffer contains no exceptions, nothing happens.
 ConstraintException toConstraintException()
          Converts the exceptions of this buffer to chained constraint exceptions.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

exceptions

protected java.util.Set exceptions
Constructor Detail

ConstraintExceptionBuffer

public ConstraintExceptionBuffer()
Constructs a ConstraintExceptionBuffer with no exceptions in it.


ConstraintExceptionBuffer

public ConstraintExceptionBuffer(ConstraintException exception)
Constructs a ConstraintExceptionBuffer containing the specified exception(s).

Parameters:
exception - the initial exception(s) to add.
Method Detail

isEmpty

public final boolean isEmpty()
Returns true if this buffer contains no exceptions; false otherwise.

Returns:
true if this buffer contains no exceptions; false otherwise.

add

public final void add(ConstraintExceptionBuffer ceb)
Adds the exceptions of the specified buffer to this buffer. Any duplicate (ConstraintException.equals()) will be silently discarded.

Parameters:
ceb - the buffer to add from (empty buffers legal).

add

public final void add(ConstraintException exception)
Adds the specified exception to the exceptions of this buffer. Any duplicate (ConstraintException.equals()) will be silently discarded.

Parameters:
exception - the exception to add (chained exceptions legal).

throwIfNotEmpty

public void throwIfNotEmpty()
                     throws AccessConstraintException,
                            ConstraintException
Throws the root exception; if this buffer contains no exceptions, nothing happens.

Throws:
ConstraintException - if this buffer contains any exceptions.
AccessConstraintException

toConstraintException

public ConstraintException toConstraintException()
Converts the exceptions of this buffer to chained constraint exceptions.

Returns:
the root exception of the chain.

toString

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

equals

public boolean equals(java.lang.Object o)
Returns true if the specified object is a buffer containing exactly the same exceptions as this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the specified object; false otherwise.

hashCode

public int hashCode()
Note! It is generally necessary to override the hashCode method whenever the equals() method is overridden. Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.


Copyright © 2005 InfoGlue.org All Rights Reserved.