All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.saxon.s9api.ValidationMode Maven / Gradle / Ivy

There is a newer version: 12.5
Show newest version
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2018-2022 Saxonica Limited
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

package net.sf.saxon.s9api;

import net.sf.saxon.lib.Validation;


/**
 * Enumeration class defining different schema validation (or construction) modes
 */
public enum ValidationMode {
    /**
     * Strict validation
     */
    STRICT(Validation.STRICT),
    /**
     * Lax validation
     */
    LAX(Validation.LAX),
    /**
     * Preserve existing type annotations if any
     */
    PRESERVE(Validation.PRESERVE),
    /**
     * Remove any existing type annotations, mark as untyped
     */
    STRIP(Validation.STRIP),
    /**
     * Value indication no preference: the choice is defined elsewhere
     */
    DEFAULT(Validation.DEFAULT);

    private final int number;

    ValidationMode(int number) {
        this.number = number;
    }

    protected int getNumber() {
        return number;
    }

    /*@NotNull*/
    protected static ValidationMode get(int number) {
        switch (number) {
            case Validation.STRICT:
                return STRICT;
            case Validation.LAX:
                return LAX;
            case Validation.STRIP:
                return STRIP;
            case Validation.PRESERVE:
                return PRESERVE;
            case Validation.DEFAULT:
            default:
                return DEFAULT;
        }
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy