de.smartics.properties.spi.config.support
Class PropertiesHelper

Package class diagram package PropertiesHelper
java.lang.Object
  extended by de.smartics.properties.spi.config.support.PropertiesHelper

public final class PropertiesHelper
     
     
extends Object

Simple utilities class to help on dealing with properties.


Constructor Summary
PropertiesHelper(ConfigurationKey<?> key)
          Default constructor.
 
Method Summary
 Properties readProperties(ClassLoader classLoader, String resourceId)
          Reads the properties from the given class path location.
 Properties readProperties(String resourceId)
          Reads the properties from the thread context class path location.
 Properties readProperties(String resourceId, InputStream input)
          Reads the properties from the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesHelper

public PropertiesHelper(ConfigurationKey<?> key)
Default constructor.

Parameters:
key - the key to the configuration to load properties for.
Method Detail

readProperties

public Properties readProperties(String resourceId)
Reads the properties from the thread context class path location.

Parameters:
resourceId - the resource on the class path to read.
Returns:
the properties from the class path.

readProperties

public Properties readProperties(ClassLoader classLoader,
                                 String resourceId)
Reads the properties from the given class path location.

Parameters:
classLoader - the class loader to access the resource.
resourceId - the resource on the class path to read.
Returns:
the properties from the class path.

readProperties

public Properties readProperties(String resourceId,
                                 InputStream input)
Reads the properties from the given stream.

Closes the stream after the properties are read.

Parameters:
resourceId - the identifier of the stream. Used for error reporting.
input - the stream to read from.
Returns:
the properties from the stream.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.