org.objectweb.telosys.common
Class Tool

java.lang.Object
  extended byorg.objectweb.telosys.common.Tool

public class Tool
extends java.lang.Object


Constructor Summary
Tool()
           
 
Method Summary
static java.lang.String buildClassName(java.lang.String sPattern, java.lang.String sBeanName)
          Build a class name by applying the given bean name in the given pattern
The string "${BEANNAME}" in the pattern will be replaced by the bean name
static java.lang.String buildPath(java.lang.String sLeftPart, java.lang.String sRightPart)
          Builds a path like "LeftPart" + "/" + "RightPart" without redundant separators
static java.lang.String buildPath(java.lang.String sLeftPart, java.lang.String sRightPart, java.lang.String sSeparatorArg)
          Builds a path like "LeftPart" + SEPARATOR + "RightPart" without redundant separators
static void closeInputStream(java.io.InputStream in)
          Close an input stream without exception
static GenericVOList createVOListInstance(java.lang.Class cl)
           
static boolean fileExists(java.lang.String sFileName)
          Check the existence of a file
static java.util.Properties findAndLoadProperties(java.lang.String sFileName)
          Try to find a properties file with classpath and load it (if found)
static java.lang.String findFileByClassPath(java.lang.String sFileName)
          Find a file using the CLASSPATH
static java.lang.String getBeanName(java.lang.Class beanClass)
          Determines the "bean name" from the given bean class
Just retuns the "simple name" of the bean class name ( e.g.
static boolean isVOListClass(java.lang.Class cl)
           
static boolean isVOListInstance(java.lang.Object obj)
           
static java.util.Properties loadProperties(java.io.InputStream is)
           
static java.util.Properties loadProperties(java.lang.String sFileName)
          Load properties from a specific file name and return them
static void showProperties(java.util.Properties prop)
          Print the content of the properties on the standard output
static void showProperties(java.util.Properties prop, java.io.PrintStream out)
          Print the content of the properties on a specific output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tool

public Tool()
Method Detail

buildPath

public static java.lang.String buildPath(java.lang.String sLeftPart,
                                         java.lang.String sRightPart)
Builds a path like "LeftPart" + "/" + "RightPart" without redundant separators

Parameters:
sLeftPart - : left part ( with or without ending "/" )
sRightPart - : right part ( with or without starting "/" )
Returns:

buildPath

public static java.lang.String buildPath(java.lang.String sLeftPart,
                                         java.lang.String sRightPart,
                                         java.lang.String sSeparatorArg)
Builds a path like "LeftPart" + SEPARATOR + "RightPart" without redundant separators

Parameters:
sLeftPart - : left part ( with or without ending separator )
sRightPart - : right part ( with or without starting separator )
sSeparatorArg - : the separator to use ( e.g. "/", ".", ... )
Returns:

closeInputStream

public static void closeInputStream(java.io.InputStream in)
Close an input stream without exception

Parameters:
in -

fileExists

public static boolean fileExists(java.lang.String sFileName)
Check the existence of a file

Parameters:
sFileName -
Returns:

findFileByClassPath

public static java.lang.String findFileByClassPath(java.lang.String sFileName)
Find a file using the CLASSPATH

Parameters:
sFileName -
Returns:

findAndLoadProperties

public static java.util.Properties findAndLoadProperties(java.lang.String sFileName)
Try to find a properties file with classpath and load it (if found)

Parameters:
sFileName -
Returns:

loadProperties

public static java.util.Properties loadProperties(java.lang.String sFileName)
Load properties from a specific file name and return them

Parameters:
sFileName -
Returns:

loadProperties

public static java.util.Properties loadProperties(java.io.InputStream is)

showProperties

public static void showProperties(java.util.Properties prop)
Print the content of the properties on the standard output

Parameters:
prop -

showProperties

public static void showProperties(java.util.Properties prop,
                                  java.io.PrintStream out)
Print the content of the properties on a specific output

Parameters:
prop -
out -

isVOListClass

public static boolean isVOListClass(java.lang.Class cl)

isVOListInstance

public static boolean isVOListInstance(java.lang.Object obj)

createVOListInstance

public static GenericVOList createVOListInstance(java.lang.Class cl)

buildClassName

public static java.lang.String buildClassName(java.lang.String sPattern,
                                              java.lang.String sBeanName)
Build a class name by applying the given bean name in the given pattern
The string "${BEANNAME}" in the pattern will be replaced by the bean name

Parameters:
sPattern - the pattern ( e.g. "my.package.${BEANNAME}Suffix" )
sBeanName -
Returns:
Since:
1.0.0

getBeanName

public static java.lang.String getBeanName(java.lang.Class beanClass)
Determines the "bean name" from the given bean class
Just retuns the "simple name" of the bean class name ( e.g. "MyBean" for "my.package.MyBean" )

Parameters:
beanClass -
Returns: