net.ontopia.utils
Class PropertyUtils

java.lang.Object
  extended by net.ontopia.utils.PropertyUtils

public class PropertyUtils
extends java.lang.Object

INTERNAL: Utility class for handling properties and their values.


Constructor Summary
PropertyUtils()
           
 
Method Summary
static int getInt(java.lang.String property_value)
           
static int getInt(java.lang.String property_value, int default_value)
          INTERNAL: Returns the property value as an int.
static java.lang.String getProperty(java.util.Map properties, java.lang.String name)
          INTERNAL: Helper method used to get better error messages with less typing.
static java.lang.String getProperty(java.util.Map properties, java.lang.String name, boolean required)
          INTERNAL: Helper method used to get better error messages with less typing.
static boolean isTrue(java.util.Map properties, java.lang.String name)
          INTERNAL: Same as isTrue(Map, String, boolean) with the default set to false;
static boolean isTrue(java.util.Map properties, java.lang.String name, boolean default_value)
          INTERNAL: Helper method used to get the value of boolean properties.
static boolean isTrue(java.lang.String property_value)
           
static boolean isTrue(java.lang.String property_value, boolean default_value)
           
static java.util.Properties loadProperties(java.io.File propfile)
          INTERNAL; Reads properties from a file.
static java.util.Properties loadProperties(java.io.InputStream istream)
           
static java.util.Properties loadProperties(java.lang.String propfile)
          INTERNAL; Reads properties from a file.
static java.util.Properties loadPropertiesFromClassPath(java.lang.String resource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyUtils

public PropertyUtils()
Method Detail

getProperty

public static java.lang.String getProperty(java.util.Map properties,
                                           java.lang.String name)
INTERNAL: Helper method used to get better error messages with less typing.


getProperty

public static java.lang.String getProperty(java.util.Map properties,
                                           java.lang.String name,
                                           boolean required)
INTERNAL: Helper method used to get better error messages with less typing.


isTrue

public static boolean isTrue(java.util.Map properties,
                             java.lang.String name,
                             boolean default_value)
INTERNAL: Helper method used to get the value of boolean properties. This method will return true if the property has the values 'yes', 'true'. Otherwise the default value is returned.


isTrue

public static boolean isTrue(java.util.Map properties,
                             java.lang.String name)
INTERNAL: Same as isTrue(Map, String, boolean) with the default set to false;


isTrue

public static boolean isTrue(java.lang.String property_value)

isTrue

public static boolean isTrue(java.lang.String property_value,
                             boolean default_value)

getInt

public static int getInt(java.lang.String property_value,
                         int default_value)
INTERNAL: Returns the property value as an int. If the value is not set or any problems occur the default value is returned.


getInt

public static int getInt(java.lang.String property_value)
                  throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

loadProperties

public static java.util.Properties loadProperties(java.lang.String propfile)
                                           throws java.io.IOException
INTERNAL; Reads properties from a file.

Throws:
java.io.IOException

loadProperties

public static java.util.Properties loadProperties(java.io.File propfile)
                                           throws java.io.IOException
INTERNAL; Reads properties from a file.

Throws:
java.io.IOException

loadPropertiesFromClassPath

public static java.util.Properties loadPropertiesFromClassPath(java.lang.String resource)
                                                        throws java.io.IOException
Throws:
java.io.IOException

loadProperties

public static java.util.Properties loadProperties(java.io.InputStream istream)
                                           throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2000-2012 Ontopia.