public class PropertiesUtil
extends java.lang.Object
PropertiesUtil is a utility class providing some
 useful utility methods for converting property types.| Constructor and Description | 
|---|
| PropertiesUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static boolean | toBoolean(java.lang.Object propValue,
         boolean defaultValue)Returns the boolean value of the parameter or the
  defaultValueif the parameter isnull. | 
| static double | toDouble(java.lang.Object propValue,
        double defaultValue)Returns the parameter as a double or the
  defaultValueif the parameter isnullor if
 the parameter is not aDoubleand cannot be converted to
 aDoublefrom the parameter's string value. | 
| static int | toInteger(java.lang.Object propValue,
         int defaultValue)Returns the parameter as an integer or the
  defaultValueif the parameter isnullor if
 the parameter is not anIntegerand cannot be converted to
 anIntegerfrom the parameter's string value. | 
| static long | toLong(java.lang.Object propValue,
      long defaultValue)Returns the parameter as a long or the
  defaultValueif the parameter isnullor if
 the parameter is not aLongand cannot be converted to
 aLongfrom the parameter's string value. | 
| static java.util.Map<java.lang.String,java.lang.String> | toMap(java.lang.Object propValue,
     java.lang.String[] defaultArray)Returns the parameter as a map with string keys and string values. | 
| static java.lang.Object | toObject(java.lang.Object propValue)Returns the parameter as a single value. | 
| static java.lang.String | toString(java.lang.Object propValue,
        java.lang.String defaultValue)Returns the parameter as a string or the
  defaultValueif the parameter isnull. | 
| static java.lang.String[] | toStringArray(java.lang.Object propValue)Returns the parameter as an array of Strings. | 
| static java.lang.String[] | toStringArray(java.lang.Object propValue,
             java.lang.String[] defaultArray)Returns the parameter as an array of Strings. | 
public static boolean toBoolean(java.lang.Object propValue,
                                boolean defaultValue)
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.propValue - the property value or nulldefaultValue - the default boolean valuepublic static java.lang.String toString(java.lang.Object propValue,
                                        java.lang.String defaultValue)
defaultValue if the parameter is null.propValue - the property value or nulldefaultValue - the default string valuepublic static long toLong(java.lang.Object propValue,
                          long defaultValue)
defaultValue if the parameter is null or if
 the parameter is not a Long and cannot be converted to
 a Long from the parameter's string value.propValue - the property value or nulldefaultValue - the default long valuepublic static int toInteger(java.lang.Object propValue,
                            int defaultValue)
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.propValue - the property value or nulldefaultValue - the default integer valuepublic static double toDouble(java.lang.Object propValue,
                              double defaultValue)
defaultValue if the parameter is null or if
 the parameter is not a Double and cannot be converted to
 a Double from the parameter's string value.propValue - the property value or nulldefaultValue - the default double valuepublic static java.lang.Object toObject(java.lang.Object propValue)
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.propValue - the parameter to convert.public static java.lang.String[] toStringArray(java.lang.Object propValue)
null) null is
 returned.propValue - The object to convert.public static java.lang.String[] toStringArray(java.lang.Object propValue,
                                               java.lang.String[] defaultArray)
null) a provided default value is
 returned.propValue - The object to convert.defaultArray - The default array to return.public static java.util.Map<java.lang.String,java.lang.String> toMap(java.lang.Object propValue,
                                                                     java.lang.String[] defaultArray)
null) a provided default value is
 returned.propValue - The object to convert.defaultArray - The default array converted to map.Copyright © 2018 The Apache Software Foundation. All rights reserved.