Package com.networknt.schema.resource
Class MapResourceLoader
- java.lang.Object
-
- com.networknt.schema.resource.MapResourceLoader
-
- All Implemented Interfaces:
ResourceLoader
public class MapResourceLoader extends Object implements ResourceLoader
Map implementation ofResourceLoader.
-
-
Constructor Summary
Constructors Constructor Description MapResourceLoader(Function<String,String> mappings)Sets the resource data by absolute IRI function.MapResourceLoader(Function<String,T> mapIriToObject, Function<T,String> mapObjectToData)Sets the resource data by using two mapping functions.MapResourceLoader(Map<String,String> mappings)Sets the resource data by absolute IRI.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamSourcegetResource(AbsoluteIri absoluteIri)Loads data given the retrieval IRI.
-
-
-
Constructor Detail
-
MapResourceLoader
public MapResourceLoader(Map<String,String> mappings)
Sets the resource data by absolute IRI.- Parameters:
mappings- the mappings
-
MapResourceLoader
public MapResourceLoader(Function<String,String> mappings)
Sets the resource data by absolute IRI function.- Parameters:
mappings- the mappings
-
MapResourceLoader
public MapResourceLoader(Function<String,T> mapIriToObject, Function<T,String> mapObjectToData)
Sets the resource 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 resource data.
- Type Parameters:
T- the type of the object- Parameters:
mapIriToObject- the mapping of IRI to objectmapObjectToData- the mappingof object to resource data
-
-
Method Detail
-
getResource
public InputStreamSource getResource(AbsoluteIri absoluteIri)
Description copied from interface:ResourceLoaderLoads data given the retrieval IRI.- Specified by:
getResourcein interfaceResourceLoader- Parameters:
absoluteIri- the retrieval IRI- Returns:
- the input stream source
-
-