com.helger.bdve.execute.IValidationExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ph-bdve Show documentation
Show all versions of ph-bdve Show documentation
Business Document Validation Engine (BDVE)
/**
* Copyright (C) 2014-2020 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.bdve.execute;
import java.io.Serializable;
import java.util.Locale;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.helger.bdve.EValidationType;
import com.helger.bdve.artefact.IValidationArtefact;
import com.helger.bdve.result.ValidationResult;
import com.helger.bdve.source.IValidationSource;
import com.helger.commons.annotation.MustImplementEqualsAndHashcode;
/**
* Base interface for performing validation of a single XML document based on
* the rules of a single validation artefact.
*
* @author Philip Helger
*/
@MustImplementEqualsAndHashcode
public interface IValidationExecutor extends Serializable
{
/**
* Nested interface for validation executors that support caching.
*
* @author Philip Helger
* @since 3.1.1
*/
public interface ICacheSupport
{
boolean DEFAULT_CACHE = true;
/**
* @return true
if caching is enabled, false
if
* not.
*/
boolean isCacheArtefact ();
/**
* Enable or disable caching.
*
* @param bCacheArtefact
* true
to enable caching, false
to disable
* it.
* @return this for chaining
*/
@Nonnull
ICacheSupport setCacheArtefact (boolean bCacheArtefact);
}
/**
* @return The validation artefact used to validate the XML instances. Never
* null
.
*/
@Nonnull
IValidationArtefact getValidationArtefact ();
/**
* @return The type of validation performed by this executor. Never
* null
.
*/
@Nonnull
default EValidationType getValidationType ()
{
return getValidationArtefact ().getValidationArtefactType ();
}
/**
* Perform validation. The class loader of the validation artefact is used.
*
* @param aSource
* Source to be validated. May not be null
.
* @return Never null
.
*/
@Nonnull
default ValidationResult applyValidation (@Nonnull final IValidationSource aSource)
{
return applyValidation (aSource, (Locale) null);
}
/**
* Perform validation
*
* @param aSource
* Source to be validated. May not be null
.
* @param aLocale
* The locale to use for error messages if applicable. May be
* null
in which case the system default locale is used.
* @return Never null
.
*/
@Nonnull
ValidationResult applyValidation (@Nonnull IValidationSource aSource,
@Nullable Locale aLocale);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy