GigaSpaces XAP 9.7.2 API

org.openspaces.core.util
Class StringPropertiesUtils

java.lang.Object
  extended by org.openspaces.core.util.StringPropertiesUtils

public class StringPropertiesUtils
extends Object


Constructor Summary
StringPropertiesUtils()
           
 
Method Summary
static Map<String,String> convertPropertiesToMapStringString(Properties properties2)
           
static String[] getArgumentsArray(Map<String,String> properties, String key, String[] defaultValue)
           
static String[] getArray(Map<String,String> properties, String key, String separator, String[] defaultValue)
           
static boolean getBoolean(Map<String,String> properties, String key, boolean defaultValue)
           
static Object getConfig(Map<String,String> properties, String key, Object defaultValue)
          Gets an object that has a constructor that accepts Map as a single argument
static double getDouble(Map<String,String> properties, String key, double defaultValue)
           
static double getDoubleIgnoreExceptions(Map<String,String> properties, String key, double defaultValue)
           
static int getInteger(Map<String,String> properties, String key, int defaultValue)
           
static int getIntegerIgnoreExceptions(Map<String,String> properties, String key, int defaultValue)
           
static Map<String,String> getKeyValuePairs(Map<String,String> properties, String key, String pairSeperator, String keyValueSeperator, Map<String,String> defaultValue)
           
static long getLong(Map<String,String> properties, String key, long defaultValue)
           
static long getLongIgnoreExceptions(Map<String,String> properties, String key, long defaultValue)
           
static Map<String,String> getMap(Map<String,String> properties, String keyPrefix, Map<String,String> defaultValue)
           
static Set<String> getSet(Map<String,String> properties, String key, String separator, Set<String> defaultValue)
           
static Object getStringWrapperObject(Map<String,String> properties, String key, Object defaultValue)
          Gets an object that has a constructor that accepts String as a single argument
static Map<String,String> load(InputStream in)
           
static Map<String,String> load(String filename)
           
static void putArgumentsArray(Map<String,String> properties, String key, String[] array)
          Concatenates the specified array into a combined string using the space separator and puts the result as a value into the specified properties with the specified key.
static void putArray(Map<String,String> properties, String key, String[] array, String separator)
          Concatenates the specified array into a combined string using the specified separator and puts the result as a value into the specified properties with the specified key.
static void putBoolean(Map<String,String> properties, String key, boolean value)
           
static void putConfig(Map<String,String> properties, String key, Object object)
          Puts an object that has a constructor that accepts Map as a single argument and has a getProperties method which returns a Map If object is null it is removed from the map
static void putDouble(Map<String,String> properties, String key, double value)
           
static void putInteger(Map<String,String> properties, String key, int value)
           
static void putKeyValuePairs(Map<String,String> properties, String key, Map<String,String> value, String pairSeperator, String keyValueSeperator)
           
static void putLong(Map<String,String> properties, String key, long value)
           
static void putMap(Map<String,String> properties, String keyPrefix, Map<String,String> value)
          Puts the map as a value by adding the specified prefix to each key If value is null the object is removed from properties.
static void putSet(Map<String,String> properties, String key, Set<String> value, String separator)
           
static void putStringWrapperObject(Map<String,String> properties, String key, Object value)
          Puts an object that has a constructor that accepts String as a single argument
static void store(Map<String,String> properties, OutputStream out, String comments)
           
static String toString(Map<String,String> properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPropertiesUtils

public StringPropertiesUtils()
Method Detail

store

public static void store(Map<String,String> properties,
                         OutputStream out,
                         String comments)
                  throws IOException
Throws:
IOException

load

public static Map<String,String> load(InputStream in)
                               throws IOException
Throws:
IOException

convertPropertiesToMapStringString

public static Map<String,String> convertPropertiesToMapStringString(Properties properties2)

load

public static Map<String,String> load(String filename)
                               throws IOException
Throws:
IOException

getInteger

public static int getInteger(Map<String,String> properties,
                             String key,
                             int defaultValue)
                      throws NumberFormatException
Throws:
NumberFormatException

getIntegerIgnoreExceptions

public static int getIntegerIgnoreExceptions(Map<String,String> properties,
                                             String key,
                                             int defaultValue)

putLong

public static void putLong(Map<String,String> properties,
                           String key,
                           long value)

getLong

public static long getLong(Map<String,String> properties,
                           String key,
                           long defaultValue)
                    throws NumberFormatException
Throws:
NumberFormatException

getLongIgnoreExceptions

public static long getLongIgnoreExceptions(Map<String,String> properties,
                                           String key,
                                           long defaultValue)

putDouble

public static void putDouble(Map<String,String> properties,
                             String key,
                             double value)

getDouble

public static double getDouble(Map<String,String> properties,
                               String key,
                               double defaultValue)
                        throws NumberFormatException
Throws:
NumberFormatException

getDoubleIgnoreExceptions

public static double getDoubleIgnoreExceptions(Map<String,String> properties,
                                               String key,
                                               double defaultValue)

putArray

public static void putArray(Map<String,String> properties,
                            String key,
                            String[] array,
                            String separator)
Concatenates the specified array into a combined string using the specified separator and puts the result as a value into the specified properties with the specified key. The values in the array must not contain the separator otherwise an IllegalArgumentException is raised. Null or empty arrays will remove the key from the properties map


getArray

public static String[] getArray(Map<String,String> properties,
                                String key,
                                String separator,
                                String[] defaultValue)

getSet

public static Set<String> getSet(Map<String,String> properties,
                                 String key,
                                 String separator,
                                 Set<String> defaultValue)

putSet

public static void putSet(Map<String,String> properties,
                          String key,
                          Set<String> value,
                          String separator)

putArgumentsArray

public static void putArgumentsArray(Map<String,String> properties,
                                     String key,
                                     String[] array)
Concatenates the specified array into a combined string using the space separator and puts the result as a value into the specified properties with the specified key. If the values in the array contains whitespace it is enclosed with " or ' characters


getArgumentsArray

public static String[] getArgumentsArray(Map<String,String> properties,
                                         String key,
                                         String[] defaultValue)

putInteger

public static void putInteger(Map<String,String> properties,
                              String key,
                              int value)

putBoolean

public static void putBoolean(Map<String,String> properties,
                              String key,
                              boolean value)

getBoolean

public static boolean getBoolean(Map<String,String> properties,
                                 String key,
                                 boolean defaultValue)

getMap

public static Map<String,String> getMap(Map<String,String> properties,
                                        String keyPrefix,
                                        Map<String,String> defaultValue)

putMap

public static void putMap(Map<String,String> properties,
                          String keyPrefix,
                          Map<String,String> value)
Puts the map as a value by adding the specified prefix to each key If value is null the object is removed from properties.


toString

public static String toString(Map<String,String> properties)

putKeyValuePairs

public static void putKeyValuePairs(Map<String,String> properties,
                                    String key,
                                    Map<String,String> value,
                                    String pairSeperator,
                                    String keyValueSeperator)

getKeyValuePairs

public static Map<String,String> getKeyValuePairs(Map<String,String> properties,
                                                  String key,
                                                  String pairSeperator,
                                                  String keyValueSeperator,
                                                  Map<String,String> defaultValue)

putConfig

public static void putConfig(Map<String,String> properties,
                             String key,
                             Object object)
Puts an object that has a constructor that accepts Map as a single argument and has a getProperties method which returns a Map If object is null it is removed from the map


getConfig

public static Object getConfig(Map<String,String> properties,
                               String key,
                               Object defaultValue)
Gets an object that has a constructor that accepts Map as a single argument


putStringWrapperObject

public static void putStringWrapperObject(Map<String,String> properties,
                                          String key,
                                          Object value)
Puts an object that has a constructor that accepts String as a single argument


getStringWrapperObject

public static Object getStringWrapperObject(Map<String,String> properties,
                                            String key,
                                            Object defaultValue)
Gets an object that has a constructor that accepts String as a single argument


GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.