/*******************************************************************************
 * Copyright (c) 2011, 2017 Eurotech and/or its affiliates and others
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *  
 * Contributors:
 *     Eurotech - initial API and implementation
 *******************************************************************************/
package org.eclipse.kapua.message.xml;

import org.eclipse.kapua.model.xml.ObjectTypeXmlAdapter;

public class MetricTypeXmlAdapter extends ObjectTypeXmlAdapter {

    private static final String TYPE_BASE_64_BINARY = "base64binary";

    @Override
    public String marshal(Class<?> clazz) {

        String value;
        if (clazz == byte[].class) {
            value = TYPE_BASE_64_BINARY;
        } else {
            value = super.marshal(clazz);
        }

        return value;
    }

    @Override
    public Class<?> unmarshal(String value) throws ClassNotFoundException {
        Class<?> clazz;
        if (TYPE_BASE_64_BINARY.equals(value)) {
            clazz = byte[].class;
        } else {
            clazz = super.unmarshal(value);
        }
        return clazz;
    }
}

@@ -644,16 +644,284 @@
 apter;%0A%0A
+/**%0A * XML Adapter from metric type. %3Cbr%3E %0A * This adapter extends %7B@link ObjectTypeXmlAdapter%7D and serialize/deserialize in a different way the %0A * %7B@link Byte%7D%5B%5D metric type.%0A * %0A * This is because Kapua uses Base64 encoding of binary data. %0A * %0A * @since 1.0.0%0A */%0A
 public c

Clean up and applyed code formatting