org.apache.synapse.securevault.commons
Class MiscellaneousUtil

java.lang.Object
  extended by org.apache.synapse.securevault.commons.MiscellaneousUtil

public class MiscellaneousUtil
extends Object

TODO - This is a copy of class in synapse commons


Method Summary
static byte[] asBytes(InputStream in)
           
static String getProperty(Properties properties, String name, String defaultValue)
          Helper method to get the value of the property from a given property bag
static
<T> T
getProperty(Properties properties, String name, T defaultValue, Class<? extends T> type)
          Helper method to get the value of the property from a given property bag This method will return a value with the type equal to the type given by the Class type parameter.
static Properties loadProperties(String filePath)
          Loads the properties from a given property file path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProperty

public static String getProperty(Properties properties,
                                 String name,
                                 String defaultValue)
Helper method to get the value of the property from a given property bag

Parameters:
properties - The property collection
name - The name of the property
defaultValue - The default value for the property
Returns:
The value of the property if it is found , otherwise , default value

getProperty

public static <T> T getProperty(Properties properties,
                                String name,
                                T defaultValue,
                                Class<? extends T> type)
Helper method to get the value of the property from a given property bag This method will return a value with the type equal to the type given by the Class type parameter. Therefore, The user of this method can ensure that he is get what he request

Parameters:
properties - Properties bag
name - Name of the property
defaultValue - Default value
type - Expected Type using Class
Returns:
Value corresponding to the given property name

loadProperties

public static Properties loadProperties(String filePath)
Loads the properties from a given property file path

Parameters:
filePath - Path of the property file
Returns:
Properties loaded from given file

asBytes

public static byte[] asBytes(InputStream in)


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.