1 /*
2 * Copyright (C) The Spice Group. All rights reserved.
3 *
4 * This software is published under the terms of the Spice
5 * Software License version 1.1, a copy of which has been included
6 * with this distribution in the LICENSE.txt file.
7 */
8 package org.codehaus.spice.configkit;
9
10 /***
11 * Result of validating a document against a schema. The result indicates
12 * whether validation was successful, any exception throws by validator and any
13 * {@link ValidationIssue}s that were reported.
14 *
15 * @author Peter Donald
16 * @author <a href="mailto:proyal at apache.org">Peter Royal</a>
17 * @version $Revision: 1.1 $ $Date: 2003/12/03 03:19:28 $
18 */
19 public class ValidationResult
20 {
21 /*** Validation exception if validation not successful, else null. */
22 private final ValidateException m_exception;
23
24 /*** The issues that were reported during validation. */
25 private final ValidationIssue[] m_issues;
26
27 /***
28 * Create a ValidationResult.
29 *
30 * @param exception the exception thrown if validation failed
31 * @param issues the issues that were reported during validation.
32 */
33 public ValidationResult( final ValidateException exception,
34 final ValidationIssue[] issues )
35 {
36 if( null == issues )
37 {
38 throw new NullPointerException( "issues" );
39 }
40 for( int i = 0; i < issues.length; i++ )
41 {
42 final ValidationIssue issue = issues[ i ];
43 if( null == issue )
44 {
45 throw new NullPointerException( "issues[" + i + "]" );
46 }
47 }
48 m_exception = exception;
49 m_issues = issues;
50 }
51
52 /***
53 * Return true if validation successful. false otherwise.
54 *
55 * @return true if validation successful. false otherwise.
56 */
57 public boolean isValid()
58 {
59 return null == getException();
60 }
61
62 /***
63 * Return the exception thrown if validation not successful.
64 *
65 * @return the exception thrown if validation not successful.
66 */
67 public ValidateException getException()
68 {
69 return m_exception;
70 }
71
72 /***
73 * Return the issues that were reported during validation.
74 *
75 * @return the issues that were reported during validation.
76 */
77 public ValidationIssue[] getIssues()
78 {
79 return m_issues;
80 }
81 }
This page was automatically generated by Maven