Package com.networknt.schema.uri
Interface URITranslator
-
- All Known Implementing Classes:
URITranslator.CompositeURITranslator,URITranslator.MappingURITranslator,URITranslator.PrefixReplacer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface URITranslator
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classURITranslator.CompositeURITranslatorstatic classURITranslator.MappingURITranslatorProvides support for legacy map-based translationsstatic classURITranslator.PrefixReplacerReplaces the beginning of a URI
-
Field Summary
Fields Modifier and Type Field Description static URITranslatorNOOP
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static URITranslator.CompositeURITranslatorcombine(URITranslator... uriTranslators)Creates a CompositeURITranslator.static URITranslator.CompositeURITranslatorcombine(Collection<? extends URITranslator> uriTranslators)Creates a CompositeURITranslator.static URITranslatormap(String source, String target)Creates a simple mapping from one URI to another.static URITranslatormap(URI source, URI target)Creates a simple mapping from one URI to another.static URITranslatormap(Map<String,String> uriMappings)Creates a map-based mapping from one URI to another.static URITranslatorprefix(String source, String target)Creates a mapping from one URI to another by replacing the beginning of the URI.URItranslate(URI original)Translates one URI into another.
-
-
-
Field Detail
-
NOOP
static final URITranslator NOOP
-
-
Method Detail
-
translate
URI translate(URI original)
Translates one URI into another.- Parameters:
original- the URI to translate- Returns:
- the translated URI or the original URI if it did not match the conditions triggering translation
-
map
static URITranslator map(String source, String target)
Creates a simple mapping from one URI to another.- Parameters:
source- the URI to matchtarget- the URI to return when matched- Returns:
- a new URITranslator
-
map
static URITranslator map(URI source, URI target)
Creates a simple mapping from one URI to another.- Parameters:
source- the URI to matchtarget- the URI to return when matched- Returns:
- a new URITranslator
-
map
static URITranslator map(Map<String,String> uriMappings)
Creates a map-based mapping from one URI to another.- Parameters:
uriMappings- the mappings to build- Returns:
- a new URITranslator
-
combine
static URITranslator.CompositeURITranslator combine(URITranslator... uriTranslators)
Creates a CompositeURITranslator.- Parameters:
uriTranslators- the translators to combine- Returns:
- a new CompositeURITranslator
-
prefix
static URITranslator prefix(String source, String target)
Creates a mapping from one URI to another by replacing the beginning of the URI.For example, replace http with https.
- Parameters:
source- the search stringtarget- the replacement string- Returns:
- a new URITranslator
-
combine
static URITranslator.CompositeURITranslator combine(Collection<? extends URITranslator> uriTranslators)
Creates a CompositeURITranslator.- Parameters:
uriTranslators- the translators to combine- Returns:
- a new CompositeURITranslator
-
-