All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.bz.opendatahub.alpinebits.xml.xmladapter.LocalDateAdapter Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package it.bz.opendatahub.alpinebits.xml.xmladapter;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.time.LocalDate;

/**
 * XML adapter to convert xs:date values to {@link LocalDate}.
 */
public class LocalDateAdapter extends XmlAdapter {
    @Override
    public LocalDate unmarshal(String v) {
        return LocalDate.parse(v);
    }

    @Override
    public String marshal(LocalDate v) {
        return v != null ? v.toString() : null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy