Class MappingWriters
java.lang.Object
org.openehealth.ipf.commons.map.MappingWriters
Discovery of
MappingWriter implementations through ServiceLoader.- Since:
- 6.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<MappingWriter> discover()static Optional<MappingWriter> forExtension(String extension) static Optional<MappingWriter> formats()static Optional<MappingWriter> Resolves a target format named either way, so that a caller - a command line above all - can sayxmlor.mapping.xmland mean the same writer.static voidrequireKeysAndValues(List<? extends Mapping> mappings) Rejects entries without a key or a value, which the model tolerates - a Groovy script may declare(null) : 'x'- but no file format can state.
-
Method Details
-
discover
- Returns:
- all writers visible to the current thread's context class loader, falling back to the class loader of this class
-
forExtension
- Parameters:
extension- a file extension including the leading dot, compared case-insensitively- Returns:
- the first discovered writer producing that extension
-
forFormat
- Parameters:
format- aformat id, compared case-insensitively- Returns:
- the writer producing that format, empty if none on the classpath does
- Throws:
IllegalStateException- if several writers claim the same format id
-
forTarget
Resolves a target format named either way, so that a caller - a command line above all - can sayxmlor.mapping.xmland mean the same writer.- Parameters:
target- aformat idor a file extension- Returns:
- the writer producing it, empty if none on the classpath does
-
formats
-
extensions
-
requireKeysAndValues
Rejects entries without a key or a value, which the model tolerates - a Groovy script may declare(null) : 'x'- but no file format can state. Writers call this before writing anything, so that a mapping file is never produced that its own loader rejects.- Parameters:
mappings- the mappings to be written- Throws:
IllegalArgumentException- naming the first mapping with such an entry
-