TrueZIP Kernel 7.0-rc2

de.schlichtherle.truezip.io
Class SequentialIOExceptionBuilder<C extends Exception,E extends SequentialIOException>

java.lang.Object
  extended by de.schlichtherle.truezip.util.AbstractExceptionBuilder<C,E>
      extended by de.schlichtherle.truezip.io.SequentialIOExceptionBuilder<C,E>
Type Parameters:
C - The type of the cause exception.
E - The type of the assembled exception.
All Implemented Interfaces:
ExceptionBuilder<C,E>, ExceptionHandler<C,E>
Direct Known Subclasses:
FsSyncExceptionBuilder

@NotThreadSafe
public class SequentialIOExceptionBuilder<C extends Exception,E extends SequentialIOException>
extends AbstractExceptionBuilder<C,E>

Assembles a SequentialIOException from one or more Exceptions by chaining them. When the assembly is thrown or returned later, it is sorted by priority.

Author:
Christian Schlichtherle

Field Summary
private  Class<E> clazz
           
 
Constructor Summary
SequentialIOExceptionBuilder(Class<C> c, Class<E> e)
           
 
Method Summary
static SequentialIOExceptionBuilder<SequentialIOException,SequentialIOException> create()
          Static constructor provided for comforting the most prominent use case.
protected  E post(E assembly)
          This method is called to post-process the given result of the assembly after it has been checked out.
protected  E update(C cause, E previous)
          Chains the given exceptions and returns the result.
 
Methods inherited from class de.schlichtherle.truezip.util.AbstractExceptionBuilder
check, fail, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clazz

private final Class<E extends SequentialIOException> clazz
Constructor Detail

SequentialIOExceptionBuilder

public SequentialIOExceptionBuilder(Class<C> c,
                                    Class<E> e)
Method Detail

create

public static SequentialIOExceptionBuilder<SequentialIOException,SequentialIOException> create()
Static constructor provided for comforting the most prominent use case.


update

protected final E update(C cause,
                         E previous)
Chains the given exceptions and returns the result.

Specified by:
update in class AbstractExceptionBuilder<C extends Exception,E extends SequentialIOException>
Parameters:
cause - A(nother) non-null cause exception to add to the assembly.
previous - The previous result of the assembly or null if this is the first call since the creation of this instance or the last assembly has been checked out.
Returns:
The assembled exception. null is not permitted.
Throws:
IllegalStateException - if cause.SequentialIOException.getPredecessor() is already initialized by a previous call to SequentialIOException.initPredecessor(SequentialIOException).

post

protected final E post(E assembly)
This method is called to post-process the given result of the assembly after it has been checked out.

The implementation in the class AbstractExceptionBuilder simply returns the parameter.

Sorts the given exception chain by priority and returns the result.

Overrides:
post in class AbstractExceptionBuilder<C extends Exception,E extends SequentialIOException>
Parameters:
assembly - The checked out result of the exception assembly - may be null.
Returns:
The post-processed checked out result of the exception assembly - may be null.

TrueZIP Kernel 7.0-rc2

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.