Package com.networknt.schema.resource
Class SchemaLoaders.Builder
- java.lang.Object
-
- com.networknt.schema.resource.SchemaLoaders.Builder
-
- Enclosing class:
- SchemaLoaders
public static class SchemaLoaders.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
Builder(SchemaLoaders.Builder copy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SchemaLoaders.Builder
add(SchemaLoader schemaLoader)
Adds a schema loader.SchemaLoaders
build()
Builds aSchemaLoaders
.SchemaLoaders.Builder
schemas(Function<String,String> schemas)
Sets the schema data by absolute IRI function.<T> SchemaLoaders.Builder
schemas(Function<String,T> mapIriToObject, Function<T,String> mapObjectToData)
Sets the schema data by using two mapping functions.SchemaLoaders.Builder
schemas(Map<String,String> schemas)
Sets the schema data by absolute IRI.SchemaLoaders.Builder
values(Consumer<List<SchemaLoader>> customizer)
Customize the schema loaders.SchemaLoaders.Builder
with(SchemaLoaders.Builder builder)
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(SchemaLoaders.Builder copy)
-
-
Method Detail
-
with
public SchemaLoaders.Builder with(SchemaLoaders.Builder builder)
-
values
public SchemaLoaders.Builder values(Consumer<List<SchemaLoader>> customizer)
Customize the schema loaders.- Parameters:
customizer
- the customizer- Returns:
- the builder
-
add
public SchemaLoaders.Builder add(SchemaLoader schemaLoader)
Adds a schema loader.- Parameters:
schemaLoader
- the schema loader- Returns:
- the builder
-
schemas
public SchemaLoaders.Builder schemas(Map<String,String> schemas)
Sets the schema data by absolute IRI.- Parameters:
schemas
- the map of IRI to schema data- Returns:
- the builder
-
schemas
public SchemaLoaders.Builder schemas(Function<String,String> schemas)
Sets the schema data by absolute IRI function.- Parameters:
schemas
- the function that returns schema data given IRI- Returns:
- the builder
-
schemas
public <T> SchemaLoaders.Builder schemas(Function<String,T> mapIriToObject, Function<T,String> mapObjectToData)
Sets the schema data by using two mapping functions.Firstly to map the IRI to an object. If the object is null no mapping is performed.
Next to map the object to the schema data.
- Type Parameters:
T
- the type of the object- Parameters:
mapIriToObject
- the mapping of IRI to objectmapObjectToData
- the mappingof object to schema data- Returns:
- the builder
-
build
public SchemaLoaders build()
Builds aSchemaLoaders
.- Returns:
- the schema loaders
-
-