com.neeve.util
Class UtlProps

java.lang.Object
  extended by com.neeve.util.UtlProps

public final class UtlProps
extends Object

Utility class containing methods to work with properties.

Several Neeve components support initialization and configuration using properties in the runtime property set. An environment property set is maintained by this class. Upon startup, it is initialized with the Java runtime system property set and updated with properties specified in the property file referenced by the system property 'nv.app.propfile' if present. This method allows the user to further update the property set in case the user wishes to override the property values set using the above described manner.

This class IS supported for use by end users.


Constructor Summary
UtlProps()
           
 
Method Summary
static Properties deserialize(String str)
          Deerialize a property table from a string
static Properties getEnvProps()
           Several Neeve components support initialization and configuration using properties in the runtime property set.
static Object getValue(Map<String,Object> props, String name)
          Get the value of a property from a property table.
static boolean getValue(Map<String,Object> props, String name, boolean defValue)
          Convenience method to return a property value as a boolean value
static double getValue(Map<String,Object> props, String name, double defValue)
          Convenience method to return a property value as a numeric value
static int getValue(Map<String,Object> props, String name, int defValue)
          Convenience method to return a property value as a numeric value
static short getValue(Map<String,Object> props, String name, short defValue)
          Convenience method to return a property value as a numeric value
static String getValue(Map<String,Object> props, String name, String defValue)
          Convenience method to return a property value as a String value
static String getValue(Properties props, String name)
          Get the value of a property from a property table.
static boolean getValue(Properties props, String name, boolean defValue)
          Convenience method to return a property value as a boolean value
static double getValue(Properties props, String name, double defValue)
          Convenience method to return a property value as a numeric value
static int getValue(Properties props, String name, int defValue)
          Convenience method to return a property value as an int value
static short getValue(Properties props, String name, short defValue)
          Convenience method to return a property value as a short value
static String getValue(Properties props, String name, String defValue)
          Convenience method to return a property value as a String value
static Object getValue(String name)
          Deprecated. Use UtlEnv.getValue(String) instead.
static boolean getValue(String name, boolean defValue)
          Deprecated. Use UtlEnv.getValue(String, boolean) instead.
static double getValue(String name, double defValue)
          Deprecated. Use UtlEnv.getValue(String, double) instead.
static String getValue(String name, String defValue)
          Deprecated. Use UtlEnv#getValue(String, String) instead.
static void serialize(Properties props, StringBuilder builder)
          Serialize a property table to a string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtlProps

public UtlProps()
Method Detail

getEnvProps

public static final Properties getEnvProps()

Several Neeve components support initialization and configuration using properties in the runtime property set. The application property set is maintained by this class. Upon startup, it is initialized with the Java runtime system property set and updated with properties specified in the property file referenced by the system property 'nv.app.propfile' if present. This method allows the user to further update the property set in case the user wishes to override the property values set using the above described manner.

Returns:
The environment.

getValue

public static String getValue(Properties props,
                              String name)
Get the value of a property from a property table.

Parameters:
props - The property table
name - The property name
Returns:
Returns the property value
Threading:
This method is safe for concurrent access by multiple threads

getValue

@Deprecated
public static final Object getValue(String name)
Deprecated. Use UtlEnv.getValue(String) instead.

Get the value of a property from the environment props.

Parameters:
name - The property name
Returns:
Returns the property value
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static final Object getValue(Map<String,Object> props,
                                    String name)
Get the value of a property from a property table.

Parameters:
props - The property table.
name - The property name
Returns:
Returns the property value
Threading:
This method is safe for concurrent access by multiple threads

getValue

@Deprecated
public static String getValue(String name,
                                         String defValue)
Deprecated. Use UtlEnv#getValue(String, String) instead.

Convenience method to return a property value as a String value from the environment

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a String value.

This method is a convenience method that returns a property value as a string value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static String getValue(Properties props,
                              String name,
                              String defValue)
Convenience method to return a property value as a String value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a String value.

This method is a convenience method that returns a property value as a string value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

@Deprecated
public static double getValue(String name,
                                         double defValue)
Deprecated. Use UtlEnv.getValue(String, double) instead.

Convenience method to return a property from the environment as a numeric value.

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.

This method is a convenience method that returns a property value as a numeric value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static double getValue(Properties props,
                              String name,
                              double defValue)
Convenience method to return a property value as a numeric value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.

This method is a convenience method that returns a property value as a numeric value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static int getValue(Properties props,
                           String name,
                           int defValue)
Convenience method to return a property value as an int value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.

This method is a convenience method that returns a property value as a numeric value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static short getValue(Properties props,
                             String name,
                             short defValue)
Convenience method to return a property value as a short value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.

This method is a convenience method that returns a property value as a numeric value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

@Deprecated
public static boolean getValue(String name,
                                          boolean defValue)
Deprecated. Use UtlEnv.getValue(String, boolean) instead.

Convenience method to return an environment property value as a boolean value

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a boolean value.

This method is a convenience method that returns a property value as a boolean value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static boolean getValue(Properties props,
                               String name,
                               boolean defValue)
Convenience method to return a property value as a boolean value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a boolean value.

This method is a convenience method that returns a property value as a boolean value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static String getValue(Map<String,Object> props,
                              String name,
                              String defValue)
Convenience method to return a property value as a String value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a String value.

This method is a convenience method that returns a property value as a string value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static short getValue(Map<String,Object> props,
                             String name,
                             short defValue)
Convenience method to return a property value as a numeric value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.

This method is a convenience method that returns a property value as a numeric value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static int getValue(Map<String,Object> props,
                           String name,
                           int defValue)
Convenience method to return a property value as a numeric value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.

This method is a convenience method that returns a property value as a numeric value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static double getValue(Map<String,Object> props,
                              String name,
                              double defValue)
Convenience method to return a property value as a numeric value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.

This method is a convenience method that returns a property value as a numeric value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getValue

public static boolean getValue(Map<String,Object> props,
                               String name,
                               boolean defValue)
Convenience method to return a property value as a boolean value

Parameters:
props - The property table
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a boolean value.

This method is a convenience method that returns a property value as a boolean value. It uses getValue(java.util.Properties, java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

serialize

public static void serialize(Properties props,
                             StringBuilder builder)
Serialize a property table to a string

Parameters:
props - The property table to serialize
builder - The string builder to serialize it to.
Threading:
This method is safe for concurrent access by multiple threads

deserialize

public static Properties deserialize(String str)
Deerialize a property table from a string

Parameters:
str - The string to deserialize it from.
Threading:
This method is safe for concurrent access by multiple threads


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.