public final class TenantlessPathSerializer
extends com.fasterxml.jackson.databind.JsonSerializer<org.hawkular.inventory.paths.Path>
Note that while the stripping can be done using a custom serializer statelessly, the re-introduction of the tenant
id to the paths needs manual intervention because the resolution is contextual - it depends on the tenant ID as well
as the intended type of the target entity and the path that the path is relative against (if the path is relative).
That's why the DetypedPathDeserializer contains a couple of static methods to inject this context into it.
So while this serializer is universally usable, the deserializer is not. It can only be used in places that can reliably inject the necessary state before the deserialization occurs.
To use this path serializer to serialize canonical (and relative) paths, you need to configure Jackson for example by providing a mixin class with custom annotations.
ObjectMapper.addMixInAnnotations(Class, Class)| Constructor and Description |
|---|
TenantlessPathSerializer() |
| Modifier and Type | Method and Description |
|---|---|
void |
serialize(org.hawkular.inventory.paths.Path value,
com.fasterxml.jackson.core.JsonGenerator jgen,
com.fasterxml.jackson.databind.SerializerProvider provider) |
public void serialize(org.hawkular.inventory.paths.Path value,
com.fasterxml.jackson.core.JsonGenerator jgen,
com.fasterxml.jackson.databind.SerializerProvider provider)
throws IOException
serialize in class com.fasterxml.jackson.databind.JsonSerializer<org.hawkular.inventory.paths.Path>IOExceptionCopyright © 2014–2017 Red Hat, Inc.. All rights reserved.