com.jpattern.util.GenericUtil Maven / Gradle / Ivy
The newest version!
package com.jpattern.util;
/**
*
* @author Francesco Cina' 09/nov/2010 - 08.51.03
*
*/
public abstract class GenericUtil {
public static E objectNotNull( final E value, final E defaultValue) {
if (value == null) {
return defaultValue;
}
return value;
}
public static E objectNotNull(final Class aClass, final E value, final E defaultValue) {
if (value == null) {
return defaultValue;
}
return value;
}
@SuppressWarnings("unchecked")
public static E castObjectNotNull(Class aClass, Object objectToCast, E defaultValue) {
if ((objectToCast == null) || !aClass.isInstance(objectToCast)) {
return defaultValue;
}
return (E) objectToCast;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy