org.jasig.portal.channels.error.error2xml
Class ThrowableToElement

java.lang.Object
  extended by org.jasig.portal.channels.error.error2xml.ThrowableToElement
All Implemented Interfaces:
IThrowableToElement

public class ThrowableToElement
extends java.lang.Object
implements IThrowableToElement

Generic ThrowableToElement which will translate any Throwable to an Element representing it. Other IThrowableToElement implementations may use this implementation as a utility to perform the generic Throwable translation and then add to the results.

Since:
uPortal 2.5
Version:
$Revision: 1.2 $ $Date: 2005/04/17 20:54:14 $
Author:
andrew.petro@yale.edu

Field Summary
private  org.apache.commons.logging.Log log
           
 
Constructor Summary
ThrowableToElement()
           
 
Method Summary
 boolean supports(java.lang.Class c)
          Returns true if the implementation knows how to translate an instance of the given class into an Element (throwableToElement() will return non-null) for instances of the class, which must extend Throwable).
 org.w3c.dom.Element throwableToElement(java.lang.Throwable t, org.w3c.dom.Document parentDoc)
          Obtain an Element representing the throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log
Constructor Detail

ThrowableToElement

public ThrowableToElement()
Method Detail

throwableToElement

public org.w3c.dom.Element throwableToElement(java.lang.Throwable t,
                                              org.w3c.dom.Document parentDoc)
                                       throws java.lang.IllegalArgumentException
Description copied from interface: IThrowableToElement
Obtain an Element representing the throwable. Throws IllegalArgumentException if t is null. Throws IllegalArgumentException if t is not supported, as indicated by the supports() method.

Specified by:
throwableToElement in interface IThrowableToElement
Parameters:
t - a supported throwable
parentDoc - document into which the element is to go
Returns:
an Element representing the Element
Throws:
java.lang.IllegalArgumentException - if t is null.

supports

public boolean supports(java.lang.Class c)
                 throws java.lang.IllegalArgumentException
Description copied from interface: IThrowableToElement
Returns true if the implementation knows how to translate an instance of the given class into an Element (throwableToElement() will return non-null) for instances of the class, which must extend Throwable). Returns false if the implementation will return null for throwableToNode() on an instance of the class. Throws IllegalArgumentException if c is not a class which extends Throwable. Throws IllegalArgumentException if c is null.

Specified by:
supports in interface IThrowableToElement
Parameters:
c - a Class extending Throwable
Returns:
true if handles instances of c, false otherwise
Throws:
java.lang.IllegalArgumentException - if c is null or does not extend Throwable