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

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

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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

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

    protected Logger logger = LoggerFactory.getLogger(IntegerAdapter.class);

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

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy