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

org.yestech.episodic.util.CommaSeperatedStringArrayXmlConverter Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package org.yestech.episodic.util;

import static org.yestech.episodic.util.EpisodicUtil.join;

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

/**
 * @author A.J. Wright
 */
public class CommaSeperatedStringArrayXmlConverter extends XmlAdapter {
    @Override
    public String[] unmarshal(String v) throws Exception {
        if (v != null && !"".equals(v)) {
            if (v.contains(",")) {
                return v.split(",");
            }
            else {
                return new String[] {v};
            }
        }
        return new String[0];
    }

    @Override
    public String marshal(String[] v) throws Exception {
        return join(v);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy