Search in sources :

Example 1 with ConnectorTypeConverter

use of com.netflix.metacat.common.server.connectors.ConnectorTypeConverter in project metacat by Netflix.

the class DozerJsonTypeConverter method convert.

@Override
public Object convert(final Object existingDestinationFieldValue, final Object sourceFieldValue, final Class<?> destinationClass, final Class<?> sourceClass) {
    JsonNode result = null;
    final Type type = (Type) sourceFieldValue;
    final ConnectorTypeConverter typeConverter;
    try {
        typeConverter = this.typeConverterFactory.get(MetacatContextManager.getContext().getDataTypeContext());
    } catch (final Exception e) {
        throw new IllegalStateException("Unable to get a type converter", e);
    }
    try {
        result = typeConverter.fromMetacatTypeToJson(type);
    } catch (final Exception ignored) {
    // TODO: Handle exception.
    }
    return result;
}
Also used : Type(com.netflix.metacat.common.type.Type) JsonNode(com.fasterxml.jackson.databind.JsonNode) ConnectorTypeConverter(com.netflix.metacat.common.server.connectors.ConnectorTypeConverter)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ConnectorTypeConverter (com.netflix.metacat.common.server.connectors.ConnectorTypeConverter)1 Type (com.netflix.metacat.common.type.Type)1