Class ObjectHelper
- java.lang.Object
-
- de.uplanet.lucy.server.auxiliaries.ObjectHelper
-
@VelocityVariable("ObjectHelper") @VelocityCallable("singleton") public final class ObjectHelper extends Object
-
-
Constructor Summary
Constructors Constructor Description ObjectHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getNull()
IValueHolder<?>
getNullValueHolder()
boolean
isFalseOrNull(Object p_obj)
Checks if the given argument is a booleanfalse
, ornull
.boolean
isNull(Object p_obj)
Checks if the given argument isnull
.boolean
isTrueOrNull(Object p_obj)
Checks if the given argument is a booleantrue
, ornull
.boolean
isVHNull(IValueHolder<?> p_vh)
boolean
isVHNullOrEmpty(IValueHolder<?> p_vh)
Object
orElse(Object p_obj, Object p_fallback)
Checks if the given object reference isnull
, and returns either the object itself if it is notnull
, or the provided fallback value if the object reference isnull
.
-
-
-
Method Detail
-
isNull
public boolean isNull(Object p_obj)
Checks if the given argument isnull
.- Parameters:
p_obj
- The value to be checked.- Returns:
true
if the given value isnull
, orfalse
otherwise.
-
orElse
public Object orElse(Object p_obj, Object p_fallback)
Checks if the given object reference isnull
, and returns either the object itself if it is notnull
, or the provided fallback value if the object reference isnull
.- Parameters:
p_obj
- The object reference to check.p_fallback
- The fallback value.- Returns:
- The value of the object reference if it is not
null
, the fallback value otherwise. - See Also:
TextUtil.fallbackIfNullOrEmpty(CharSequence, String)
-
isTrueOrNull
public boolean isTrueOrNull(Object p_obj)
Checks if the given argument is a booleantrue
, ornull
.- Parameters:
p_obj
- A boolean value, ornull
.- Returns:
true
if the given value is a booleantrue
ornull
, orfalse
otherwise.- Throws:
IllegalArgumentException
- If the given argument is neither a boolean value nornull
.
-
isFalseOrNull
public boolean isFalseOrNull(Object p_obj)
Checks if the given argument is a booleanfalse
, ornull
.- Parameters:
p_obj
- A boolean value, ornull
.- Returns:
true
if the given value is a booleanfalse
ornull
, orfalse
otherwise.- Throws:
IllegalArgumentException
- If the given argument is neither a boolean value nornull
.
-
getNull
public Object getNull()
-
getNullValueHolder
public IValueHolder<?> getNullValueHolder()
-
isVHNull
public boolean isVHNull(IValueHolder<?> p_vh)
-
isVHNullOrEmpty
public boolean isVHNullOrEmpty(IValueHolder<?> p_vh)
-
-