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

com.github.fedy2.weather.binding.adapter.FloatAdapter Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
/**
 *
 */
package com.github.fedy2.weather.binding.adapter;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * @author "Federico De Faveri [email protected]"
 */
public class FloatAdapter extends XmlAdapter {

    /**
     * {@inheritDoc}
     */
    @Override
    public String marshal(Float v) throws Exception {
        return String.valueOf(v);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Float unmarshal(String v) throws Exception {
    	if (v == null || v.isEmpty()) return null;
    	return Float.parseFloat(v);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy