View Javadoc
1   /**
2    * Copyright (C) 2014-2015 Philip Helger (www.helger.com)
3    * philip[at]helger[dot]com
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *         http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package com.helger.schematron.pure.model;
18  
19  import java.io.Serializable;
20  
21  import javax.annotation.Nonnull;
22  
23  import com.helger.commons.microdom.IMicroElement;
24  import com.helger.schematron.pure.errorhandler.IPSErrorHandler;
25  
26  /**
27   * Base interface for a single Pure Schematron element
28   *
29   * @author Philip Helger
30   */
31  public interface IPSElement extends Serializable
32  {
33    /**
34     * Check if this element is specified completely. This method stops at the
35     * first encountered error.
36     * 
37     * @param aErrorHandler
38     *        The error handler where the error details are stored. May not be
39     *        <code>null</code>.
40     * @return <code>true</code> if all mandatory fields are set and the element
41     *         is valid, <code>false</code> otherwise.
42     */
43    boolean isValid (@Nonnull IPSErrorHandler aErrorHandler);
44  
45    /**
46     * Check if this element is specified completely. This method performs all
47     * validations independent of the number of encountered error.
48     * 
49     * @param aErrorHandler
50     *        The error handler where the error details are stored. May not be
51     *        <code>null</code>.
52     */
53    void validateCompletely (@Nonnull IPSErrorHandler aErrorHandler);
54  
55    /**
56     * @return <code>true</code> if this element conforms to the Schematron
57     *         minimal syntax, <code>false</code> otherwise.
58     */
59    boolean isMinimal ();
60  
61    /**
62     * @return The XML representation of this element. Never <code>null</code>.
63     */
64    @Nonnull
65    IMicroElement getAsMicroElement ();
66  }