java.lang.Object
org.apache.sling.commons.log.logback.internal.util.Util

public class Util extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static boolean
    toBoolean(Object propValue, boolean defaultValue)
    Returns the boolean value of the parameter or the defaultValue if the parameter is null.
    static int
    toInteger(Object propValue, int defaultValue)
    Returns the parameter as an integer or the defaultValue if the parameter is null or if the parameter is not an Integer and cannot be converted to an Integer from the parameter's string value.
    static List<String>
    toList(Object values)
     
    static Object
    toObject(Object propValue)
    Returns the parameter as a single value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • toList

      public static List<String> toList(Object values)
    • close

      public static void close(InputSource is)
    • toBoolean

      public static boolean toBoolean(Object propValue, boolean defaultValue)
      Returns the boolean value of the parameter or the defaultValue if the parameter is null. If the parameter is not a Boolean it is converted by calling Boolean.valueOf on the string value of the object.
      Parameters:
      propValue - the property value or null
      defaultValue - the default boolean value
    • toInteger

      public static int toInteger(Object propValue, int defaultValue)
      Returns the parameter as an integer or the defaultValue if the parameter is null or if the parameter is not an Integer and cannot be converted to an Integer from the parameter's string value.
      Parameters:
      propValue - the property value or null
      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 a java.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-empty java.util.Collection, the first collection element is returned. Otherwise null is returned.
      Parameters:
      propValue - the parameter to convert.