Debian Codegraph @

net/sf/saxon/s9api/ValidationMode.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.s9api;
9
10 import net.sf.saxon.lib.Validation;
11
12
13 /**
14 * Enumeration class defining different schema validation (or construction) modes
15 */
16 public enum ValidationMode {
17 /**
18 * Strict validation
19 */
20 STRICT(Validation.STRICT),
21 /**
22 * Lax validation
23 */
24 LAX(Validation.LAX),
25 /**
26 * Preserve existing type annotations if any
27 */
28 PRESERVE(Validation.PRESERVE),
29 /**
30 * Remove any existing type annotations, mark as untyped
31 */
32 STRIP(Validation.STRIP),
33 /**
34 * Value indication no preference: the choice is defined elsewhere
35 */
36 DEFAULT(Validation.DEFAULT);
37
38 private int number;
39
40 private ValidationMode(int number) {
41 this.number = number;
42 }
43
44 protected int getNumber() {
45 return number;
46 }
47
48 /*@NotNull*/
49 protected static ValidationMode get(int number) {
50 switch (number) {
51 case Validation.STRICT:
52 return STRICT;
53 case Validation.LAX:
54 return LAX;
55 case Validation.STRIP:
56 return STRIP;
57 case Validation.PRESERVE:
58 return PRESERVE;
59 case Validation.DEFAULT:
60 default:
61 return DEFAULT;
62 }
63 }
64 }
65