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

com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter Maven / Gradle / Ivy

There is a newer version: 4.0.5
Show newest version
package com.sun.tools.xjc.runtime;

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

/**
 * Serializes boolean as 0 or 1.
 *
 * @author Kohsuke Kawaguchi
 * @since 2.0
 */
public class ZeroOneBooleanAdapter extends XmlAdapter {
    public Boolean unmarshal(String v) {
        return DatatypeConverter.parseBoolean(v);
    }

    public String marshal(Boolean v) {
        if(v) {
            return "1";
        } else {
            return "0";
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy