nyla.solutions.core.exception.SummaryException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nyla.solutions.core Show documentation
Show all versions of nyla.solutions.core Show documentation
This Java API provides support for application utilities (application configuration, data encryption, debugger, text processing, and more).
The newest version!
package nyla.solutions.core.exception;
import java.util.ArrayList;
import java.util.Collection;
/**
*
* SummaryException represents one or more exceptions
*
* @author Gregory Green
* @version 1.0
*/
public class SummaryException extends SystemException
{
private Collection summary = new ArrayList<>();
static final long serialVersionUID = SummaryException.class.getName().hashCode();
/**
* Constructor for ExceptionSummary initializes internal
* data settings.
*
*/
public SummaryException()
{
super();
}
/**
* Constructor for ExceptionSummary initializes internal
* data settings.
* @param aMessage the message
*/
public SummaryException(String aMessage)
{
super(aMessage);
}
/**
* Constructor for ExceptionSummary initializes internal
* data settings.
* @param throwable the nest exception
*/
public SummaryException(Throwable throwable)
{
super(throwable);
this.addException(throwable);
}
/**
* Constructor for ExceptionSummary initializes internal
* data settings.
* @param message the error message
* @param exception the nested caused exception
*/
public SummaryException(String message, Throwable exception)
{
super(message, exception);
this.addException(exception);
}
/**
* @return Returns the summary.
*/
public Collection getSummary()
{
return summary;
}
/**
* @param summary The summary to set.
*/
public void setSummary(Collection summary)
{
this.summary = summary;
}
/**
* Add exception to summary
* @param aException the exception the add
*/
public void addException(Throwable aException)
{
summary.add(aException);
}
/**
*
* @see java.lang.Throwable#toString()
*/
public String toString()
{
return super.toString()+" summary="+summary;
}
/**
* @return true if empty
* @see java.util.Collection#isEmpty()
*/
public boolean isEmpty()
{
return summary != null && summary.isEmpty();
}
/**
* @return size
* @see java.util.Collection#size()
*/
public int size()
{
if( summary == null)
return 0;
return summary.size();
}
}