public final class OpenLineageClientUtils
extends java.lang.Object
OpenLineageClient that provides common functionalities for object
mapping, JSON and YAML parsing, and URI manipulation.| Modifier and Type | Class and Description |
|---|---|
class |
OpenLineageClientUtils.DisabledFacetsMixin |
| Modifier and Type | Method and Description |
|---|---|
static void |
configureObjectMapper(java.lang.String... disableFacets)
Configures the object mapper to exclude specified facets from being serialized.
|
static <T> T |
convertValue(java.lang.Object fromValue,
java.lang.Class<T> toValueType)
Converts the value of an object from one type to another.
|
static <T> T |
fromJson(@NonNull java.lang.String json,
@NonNull com.fasterxml.jackson.core.type.TypeReference<T> type)
Converts the provided JSON string to an instance of the specified type.
|
static OpenLineageYaml |
loadOpenLineageJson(java.io.InputStream inputStream)
Loads and parses OpenLineage JSON configuration from an
InputStream. |
static OpenLineageYaml |
loadOpenLineageYaml(ConfigPathProvider configPathProvider)
Loads and parses OpenLineage configuration from the provided paths.
|
static OpenLineageYaml |
loadOpenLineageYaml(java.io.InputStream inputStream)
Loads and parses OpenLineage YAML configuration from an
InputStream. |
static <T,F> T |
mergeFacets(java.util.Map<java.lang.String,F> facetsMap,
T facetsContainer,
java.lang.Class<T> klass)
Merges the given facets map with an existing facets container, giving precedence to the values
in the facets map.
|
static com.fasterxml.jackson.databind.ObjectMapper |
newObjectMapper()
Creates a new
ObjectMapper instance configured with modules for JDK8 and JavaTime,
including settings to ignore unknown properties and to not write dates as timestamps. |
static OpenLineage.RunEvent |
runEventFromJson(@NonNull java.lang.String json)
Convenience method to convert a JSON string directly into a
OpenLineage.RunEvent instance. |
static java.lang.String |
toJson(@NonNull java.lang.Object value)
Converts the provided value to a JSON string.
|
static java.net.URI |
toUri(@NonNull java.lang.String urlString)
Converts a string URL into an
URI object. |
public static com.fasterxml.jackson.databind.ObjectMapper newObjectMapper()
ObjectMapper instance configured with modules for JDK8 and JavaTime,
including settings to ignore unknown properties and to not write dates as timestamps.ObjectMapper instance.public static void configureObjectMapper(java.lang.String... disableFacets)
disableFacets - Array of facet names to be excluded from serialization.public static java.lang.String toJson(@NonNull
@NonNull java.lang.Object value)
throws java.io.UncheckedIOException
value - The object to be converted to JSON.java.io.UncheckedIOException - If an I/O error occurs during conversion.public static <T> T fromJson(@NonNull
@NonNull java.lang.String json,
@NonNull
@NonNull com.fasterxml.jackson.core.type.TypeReference<T> type)
throws java.io.UncheckedIOException
T - The generic type of the return value.json - The JSON string to be converted.type - The type to convert the JSON string into.java.io.UncheckedIOException - If an I/O error occurs during conversion.public static OpenLineage.RunEvent runEventFromJson(@NonNull @NonNull java.lang.String json) throws java.io.UncheckedIOException
OpenLineage.RunEvent instance.json - The JSON string representing a OpenLineage.RunEvent.OpenLineage.RunEvent.java.io.UncheckedIOException - If an I/O error occurs during conversion.public static <T> T convertValue(java.lang.Object fromValue,
java.lang.Class<T> toValueType)
T - The generic type of the target type.fromValue - The object whose value is to be converted.toValueType - The target type for the conversion.public static <T,F> T mergeFacets(java.util.Map<java.lang.String,F> facetsMap,
T facetsContainer,
java.lang.Class<T> klass)
T - The type of the facets container.F - The type of facets in the map.facetsMap - A map containing facets to be merged.facetsContainer - The existing container of facets.klass - The class of the facets container.public static java.net.URI toUri(@NonNull
@NonNull java.lang.String urlString)
throws OpenLineageClientException
URI object.urlString - The string URL to be converted.URI object.OpenLineageClientException - If the given string does not conform to the URI
specification.public static OpenLineageYaml loadOpenLineageYaml(ConfigPathProvider configPathProvider) throws OpenLineageClientException
OpenLineageClientException if one of the following conditions are met:
configPathProvider - Provides the paths where the configuration files can be found.OpenLineageYaml containing the parsed configuration.OpenLineageClientException - According to the rules defined above.public static OpenLineageYaml loadOpenLineageYaml(java.io.InputStream inputStream) throws OpenLineageClientException
InputStream.inputStream - The InputStream from which to load the configuration.OpenLineageYaml containing the parsed YAML configuration.OpenLineageClientException - If an error occurs while reading or parsing the
configuration.public static OpenLineageYaml loadOpenLineageJson(java.io.InputStream inputStream) throws OpenLineageClientException
InputStream.inputStream - The InputStream from which to load the configuration.OpenLineageYaml containing the parsed JSON configuration.OpenLineageClientException - If an error occurs while reading or parsing the
configuration.