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

com.jpattern.shared.util.ValueUtil Maven / Gradle / Ivy

package com.jpattern.shared.util;


/**
 * 
 * @author Francesco Cina' 09/nov/2010 - 08.51.03
 *
 */
public abstract class ValueUtil {

	public static String stringNotNull(String value, String defaultValue) {
		return objectNotNull(String.class, value, defaultValue);
	}
	
	public static String stringNotNullTrimmed(String value, String defaultValue) {
		String result = stringNotNull(value, defaultValue);
		if ( result != null) {
			result = result.trim();
		}
		return result;
	}

	public static  E objectNotNull( E value, E defaultValue) {
		if (value == null) {
			return defaultValue;
		}
		return value;
	}
	
	public static  E objectNotNull(Class aClass, E value, E defaultValue) {
		if (value == null) {
			return defaultValue;
		}
		return value;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy