1 /*
2 * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.opensaml.xml.validation;
18
19 import java.util.List;
20
21 import org.opensaml.xml.XMLObject;
22
23 /**
24 * A functional interface for XMLObjects that offer the ability
25 * to evaluate validation rules.
26 */
27 public interface ValidatingXMLObject extends XMLObject{
28
29 /**
30 * Gets the list of validators for this XMLObject or null if there is no list.
31 *
32 * @return the list of validators for this XMLObject
33 */
34 public List<Validator> getValidators();
35
36 /**
37 * Registers a validator for this XMLObject.
38 *
39 * @param validator the validator
40 */
41 public void registerValidator(Validator validator);
42
43 /**
44 * Deregisters a validator for this XMLObject.
45 *
46 * @param validator the validator
47 */
48 public void deregisterValidator(Validator validator);
49
50 /**
51 * Validates this XMLObject against all registered validators.
52 *
53 * @param validateDescendants true if all the descendants of this object should
54 * be validated as well, false if not
55 *
56 * @throws ValidationException thrown if the element is not valid
57 */
58 public void validate(boolean validateDescendants) throws ValidationException;
59 }