public interface ValidatorFactory
Validator
instances and Validator
instances loaded by name.Modifier and Type | Method and Description |
---|---|
static ValidatorFactory |
createServiceFactory(java.lang.ClassLoader classLoader)
Creates a ValidatorFactory that discovers service providers using
the given ClassLoader.
|
static ValidatorFactory |
createServiceFactory(java.lang.Iterable<Validator> validators,
java.lang.Iterable<ValidatorService> services)
Creates a ValidatorFactory that uses a collection of built-in validators
and a collection of ValidatorService instances for configurable validators.
|
java.util.Optional<Validator> |
createValidator(java.lang.String name,
ObjectNode configuration)
Creates and configures a Validator by name.
|
java.util.List<Validator> |
loadBuiltinValidators()
Returns a list of built-in validators that are always applied to a
Model regardless of if they are explicitly configured in the metadata
of a model.
|
java.util.List<Validator> loadBuiltinValidators()
createValidator(java.lang.String, software.amazon.smithy.model.node.ObjectNode)
, which are only applied to a model if they
are declared in the metadata section of a model.java.util.Optional<Validator> createValidator(java.lang.String name, ObjectNode configuration)
name
- Name of the validator to create.configuration
- Configuration data used to create the validator.SourceException
- on configuration error.java.lang.RuntimeException
- if an error occurs while creating.static ValidatorFactory createServiceFactory(java.lang.Iterable<Validator> validators, java.lang.Iterable<ValidatorService> services)
The validators and services passed to this method are copied into a
List before creating the actual factory to avoid holding on to
ServiceLoader
VM-wide instances that potentially utilize a
Thread's context ClassLoader.
validators
- Built-in validators to provide from the factory.services
- ValidatorService instances to use to create validators.static ValidatorFactory createServiceFactory(java.lang.ClassLoader classLoader)
classLoader
- Class loader used to find ValidatorProviders.