Class Util
- java.lang.Object
-
- org.apache.sling.commons.log.logback.internal.util.Util
-
public class Util extends Object
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(InputSource is)
static boolean
toBoolean(Object propValue, boolean defaultValue)
Returns the boolean value of the parameter or thedefaultValue
if the parameter isnull
.static int
toInteger(Object propValue, int defaultValue)
Returns the parameter as an integer or thedefaultValue
if the parameter isnull
or if the parameter is not anInteger
and cannot be converted to anInteger
from the parameter's string value.static List<String>
toList(Object values)
static Object
toObject(Object propValue)
Returns the parameter as a single value.
-
-
-
Method Detail
-
close
public static void close(InputSource is)
-
toBoolean
public static boolean toBoolean(Object propValue, boolean defaultValue)
Returns the boolean value of the parameter or thedefaultValue
if the parameter isnull
. If the parameter is not aBoolean
it is converted by callingBoolean.valueOf
on the string value of the object.- Parameters:
propValue
- the property value ornull
defaultValue
- the default boolean value
-
toInteger
public static int toInteger(Object propValue, int defaultValue)
Returns the parameter as an integer or thedefaultValue
if the parameter isnull
or if the parameter is not anInteger
and cannot be converted to anInteger
from the parameter's string value.- Parameters:
propValue
- the property value ornull
defaultValue
- the default integer value
-
toObject
public static Object toObject(Object propValue)
Returns the parameter as a single value. If the parameter is neither an array nor ajava.util.Collection
the parameter is returned unmodified. If the parameter is a non-empty array, the first array element is returned. If the property is a non-emptyjava.util.Collection
, the first collection element is returned. Otherwisenull
is returned.- Parameters:
propValue
- the parameter to convert.
-
-