Package com.networknt.schema.resource
Class MapSchemaLoader
- java.lang.Object
-
- com.networknt.schema.resource.MapSchemaLoader
-
- All Implemented Interfaces:
SchemaLoader
public class MapSchemaLoader extends Object implements SchemaLoader
Map implementation ofSchemaLoader
.
-
-
Constructor Summary
Constructors Constructor Description MapSchemaLoader(Function<String,String> mappings)
Sets the schema data by absolute IRI function.MapSchemaLoader(Function<String,T> mapIriToObject, Function<T,String> mapObjectToData)
Sets the schema data by using two mapping functions.MapSchemaLoader(Map<String,String> mappings)
Sets the schema data by absolute IRI.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamSource
getSchema(AbsoluteIri absoluteIri)
Loads a schema given the retrieval IRI.
-
-
-
Constructor Detail
-
MapSchemaLoader
public MapSchemaLoader(Map<String,String> mappings)
Sets the schema data by absolute IRI.- Parameters:
mappings
- the mappings
-
MapSchemaLoader
public MapSchemaLoader(Function<String,String> mappings)
Sets the schema data by absolute IRI function.- Parameters:
mappings
- the mappings
-
MapSchemaLoader
public MapSchemaLoader(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
-
-
Method Detail
-
getSchema
public InputStreamSource getSchema(AbsoluteIri absoluteIri)
Description copied from interface:SchemaLoader
Loads a schema given the retrieval IRI.- Specified by:
getSchema
in interfaceSchemaLoader
- Parameters:
absoluteIri
- the retrieval IRI- Returns:
- the input stream source
-
-