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

com.github.debugthug.converters.StringNullConverter Maven / Gradle / Ivy

package com.github.debugthug.converters;

import org.apache.commons.lang.StringUtils;

import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;

public class StringNullConverter extends AbstractSingleValueConverter {

	@Override
	@SuppressWarnings("rawtypes")
	public boolean canConvert(Class cls) {
		return cls.equals(String.class);
	}

	@Override
	public Object fromString(String str) {

		try {

			if (StringUtils.equals(StringUtils.EMPTY, str))
				str = "null";

		}

		catch (Exception e) {
			e.printStackTrace();
		}

		return str;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy