
io.sphere.sdk.attributes.NestedAttributeMapperImpl Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.attributes;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import io.sphere.sdk.json.JsonException;
import io.sphere.sdk.products.AttributeContainer;
import java.io.IOException;
import java.util.List;
class NestedAttributeMapperImpl extends AttributeMapperImpl {
NestedAttributeMapperImpl() {
super(new TypeReference() {});
}
@Override
public AttributeContainer deserialize(JsonNode value) {
try {
return AttributeContainer.of(mapper().reader(new TypeReference>() {}).readValue(value));
} catch (final IOException e) {
throw new JsonException(e);
}
}
@Override
public JsonNode serialize(final AttributeContainer attributeContainer) {
return mapper().valueToTree(attributeContainer.getAttributes());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy