public class ObjectHelper
extends java.lang.Object
| Constructor and Description |
|---|
ObjectHelper() |
| Modifier and Type | Method and Description |
|---|---|
static <S extends ObservableBean,T extends ObservableBean> |
copyProperties(S source,
T target)
It copies from source to target (apply a bean over another bean) traversing all source's properties.
If a property is not found in the target bean or has a different type then it's ignored. |
static <T> T |
defaultValue(T object,
T whenNull)
Returns the second parameter when the first is null
|
static boolean |
equalsOrBothNull(java.lang.Object first,
java.lang.Object second)
Returns true when either both objects are non null and equals or both null
|
static <T> java.util.List<T> |
getHierarchyPath(T bean,
Property<T,T> parentProperty)
Returns a list with the path from the hierarchy root up to the given object, having the given parent property to resolve an object's parent.
|
static <T> int |
getLevel(T bean,
Property<T,T> parentProperty)
Returns the level of a given hierarchical bean.
|
static int |
hashCode(java.lang.Object object)
Returns the hashCode of the given object, handling nulls (-1 if null)
|
static boolean |
isEmpty(java.lang.Object object)
Returns whether the given object is null or an empty string, collection, map or array
|
static <T extends ObservableBean> |
isEmpty(T bean,
Property<?,? super T>... properties) |
static boolean |
isNotEmpty(java.lang.Object object)
Negated value of
isEmpty(Object) |
static boolean |
isOneOf(java.lang.Object element,
java.lang.Object... objects)
Returns true if element is one of the objects
If element or objects are null it returns false;
|
public static <S extends ObservableBean,T extends ObservableBean> void copyProperties(S source, T target)
java.lang.IllegalArgumentException - if source, target or both are null.public static <T> T defaultValue(T object,
T whenNull)
public static boolean equalsOrBothNull(java.lang.Object first,
java.lang.Object second)
public static <T> java.util.List<T> getHierarchyPath(T bean,
Property<T,T> parentProperty)
public static <T> int getLevel(T bean,
Property<T,T> parentProperty)
public static int hashCode(java.lang.Object object)
public static boolean isEmpty(java.lang.Object object)
@SafeVarargs public static <T extends ObservableBean> boolean isEmpty(T bean, Property<?,? super T>... properties)
properties - list of Properties to be checked for empty/nullisEmpty(Object)).public static boolean isNotEmpty(java.lang.Object object)
isEmpty(Object)public static boolean isOneOf(java.lang.Object element,
java.lang.Object... objects)