org.jboss.resteasy.api.validation.ViolationReport Maven / Gradle / Ivy
package org.jboss.resteasy.api.validation;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Ron Sigal
* @version $Revision: 1.1 $
*
* Copyright July 27, 2013
*/
@XmlRootElement(name="violationReport")
@XmlAccessorType(XmlAccessType.FIELD)
public class ViolationReport
{
private String exception;
private ArrayList fieldViolations = new ArrayList();
private ArrayList propertyViolations = new ArrayList();
private ArrayList classViolations = new ArrayList();
private ArrayList parameterViolations = new ArrayList();
private ArrayList returnValueViolations = new ArrayList();
public ViolationReport(final ResteasyViolationException exception)
{
Exception e = exception.getException();
if (e != null)
{
this.exception = e.toString();
}
this.fieldViolations = new ArrayList<>(exception.getFieldViolations());
this.propertyViolations = new ArrayList<>(exception.getPropertyViolations());
this.classViolations = new ArrayList<>(exception.getClassViolations());
this.parameterViolations = new ArrayList<>(exception.getParameterViolations());
this.returnValueViolations = new ArrayList<>(exception.getReturnValueViolations());
}
public ViolationReport(final String s)
{
this(new ResteasyViolationException(s));
}
public ViolationReport()
{
}
public String getException()
{
return exception;
}
public ArrayList getFieldViolations()
{
return fieldViolations;
}
public ArrayList getPropertyViolations()
{
return propertyViolations;
}
public ArrayList getClassViolations()
{
return classViolations;
}
public ArrayList getParameterViolations()
{
return parameterViolations;
}
public ArrayList getReturnValueViolations()
{
return returnValueViolations;
}
public void setException(String exception)
{
this.exception = exception;
}
public void setFieldViolations(ArrayList fieldViolations)
{
this.fieldViolations = fieldViolations;
}
public void setPropertyViolations(ArrayList propertyViolations)
{
this.propertyViolations = propertyViolations;
}
public void setClassViolations(ArrayList classViolations)
{
this.classViolations = classViolations;
}
public void setParameterViolations(ArrayList parameterViolations)
{
this.parameterViolations = parameterViolations;
}
public void setReturnValueViolations(ArrayList returnValueViolations)
{
this.returnValueViolations = returnValueViolations;
}
}