com.github.fedy2.weather.binding.adapter.FloatAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yahoo-weather-java-api Show documentation
Show all versions of yahoo-weather-java-api Show documentation
A Java library for the yahoo weather RSS feed service
The 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);
}
}