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 voidclose(InputSource is)static booleantoBoolean(Object propValue, boolean defaultValue)Returns the boolean value of the parameter or thedefaultValueif the parameter isnull.static inttoInteger(Object propValue, int defaultValue)Returns the parameter as an integer or thedefaultValueif the parameter isnullor if the parameter is not anIntegerand cannot be converted to anIntegerfrom the parameter's string value.static List<String>toList(Object values)static ObjecttoObject(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 thedefaultValueif the parameter isnull. If the parameter is not aBooleanit is converted by callingBoolean.valueOfon the string value of the object.- Parameters:
propValue- the property value ornulldefaultValue- the default boolean value
-
toInteger
public static int toInteger(Object propValue, int defaultValue)
Returns the parameter as an integer or thedefaultValueif the parameter isnullor if the parameter is not anIntegerand cannot be converted to anIntegerfrom the parameter's string value.- Parameters:
propValue- the property value ornulldefaultValue- 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.Collectionthe 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. Otherwisenullis returned.- Parameters:
propValue- the parameter to convert.
-
-