-
Notifications
You must be signed in to change notification settings - Fork 4
Components
A Configuration is an object that consists of the combination of a data Source and a Mapper to load data from different media (e.g.: file, URL) and formats (e.g.: JSON, XML, YAML), and a set of auxiliary attributes that may modify its behavior or qualify its output.
Attribute | Type | Description | Mandatory | Default |
---|---|---|---|---|
source | Source | The source associated with this configuration | Yes | N/A |
mapper | Mapper | The mapper associated with this configuration | Yes | DynamicMapper1 |
namespace | String | The namespace to be assigned to this configuration for identification in a container | No | {empty} |
precedence | int | The level of importance of this configuration compared to other ones in the same namespace | No | 0 |
optional | boolean | Marks this configuration as optional, so no exception will be raised if the source can not be found | No | false |
lazy | boolean | A flag determining that the source shall not be loaded until the data is needed | No | false |
A Source is an object that basically defines the input (e.g.: file, URL) and contains built-in logic for data access.
There are different implementations available for dedicated purposes, as enumerated in the following table:
Source | Purpose |
---|---|
ClasspathFileSource | Load a file resource from the Java classpath |
DynamicSource | Determine the actual source dynamically by checking the string prefix |
FileSource | Load a file from the file system |
StringSource | Load contents of a string |
URLSource | Load contents from a URL (local file or Web resource) |
A Mapper is an object that carries the business logic for parsing the input stream open by the Source and producing the final object, which can typically be an "object container" (such as HashMap or JSON object, for example), or even POJOs (user-defined beans), depending on the selected object.
There are several mappers available for different purposes, as enumerated in the following table:
Module | Mapper | Input format | Output type | Query language |
---|---|---|---|---|
confectory-core | DynamicMapper1 |
|
Dynamic | Dynamic |
DocumentMapper2 | org.w3c.dom.Document | XPath | ||
INIToJSONObjectMapper | net.minidev.json.JSONObject | JsonPath | ||
INIToObjectMapper<T> | T (user-defined) | N/A | ||
JSONObjectMapper | net.minidev.json.JSONObject | JsonPath | ||
PropertiesMapper | java.util.Properties | key/value | ||
PropertiesToObjectMapper<T> | T (user-defined) | N/A | ||
StringMapper | java.util.String | N/A | ||
confectory-datamapper-json-org | JsonOrgJSONObjectMapper | org.json.JSONObject | JsonPath | |
JsonOrgPropertiesToJSONObjectMapper | ||||
JsonOrgXMLToJSONObjectMapper | ||||
confectory-datamapper-gson | GsonJsonObjectMapper | com.google.gson.JsonObject | JsonPath | |
GsonJsonToObjectMapper<T> | T (user-defined) | N/A | ||
confectory-datamapper-jackson2-json | JacksonJsonNodeMapper | com.fasterxml.jackson.databind.JsonNode | JsonPath | |
JacksonJsonToObjectMapper<T> | T (user-defined) | N/A | ||
confectory-datamapper-jackson2-toml | JacksonTOMLToJsonNodeMapper | com.fasterxml.jackson.databind.JsonNode | JsonPath | |
JacksonTOMLToObjectMapper<T> | T (user-defined) | N/A | ||
confectory-datamapper-jackson2-xml | JacksonXMLToJsonNodeMapper | com.fasterxml.jackson.databind.JsonNode | JsonPath | |
JacksonXMLToObjectMapper<T> | T (user-defined) | N/A | ||
confectory-datamapper-jackson2-yaml | JacksonYAMLToJsonNodeMapper | com.fasterxml.jackson.databind.JsonNode | JsonPath | |
JacksonYAMLToObjectMapper<T> | T (user-defined) | N/A | ||
confectory-datamapper-saxon12 | SaxonXdmNodeMapper1 | net.sf.saxon.s9api.XdmNode | XPath | |
confectory-datamapper-snakeyaml | YAMLToJSONObjectMapper | net.minidev.json.JSONObject | JsonPath | |
YAMLToObjectMapper<T> | T (user-defined) | N/A |
1 Since 2.6.0
2 Since 2.4.0