org.jamon.util
Class StringUtils

java.lang.Object
  extended by org.jamon.util.StringUtils

public class StringUtils
extends java.lang.Object


Method Summary
static java.lang.String byteArrayToHexString(byte[] bytes)
          Convert a byte array into a hexidecimal representation.
static java.lang.String capitalize(java.lang.String p_string)
          Capitalize the first letter of a string.
static java.lang.String classNameToFilePath(java.lang.String p_className)
          Construct the relative path to a class file on the file system for a given class, without the ".class" suffix.
static java.lang.String classToTemplatePath(java.lang.Class<?> p_class)
          Compute the /-separated path for a given class.
static void commaJoin(java.lang.StringBuilder p_builder, java.lang.Iterable<java.lang.String> p_iterable)
          Concatenate a list of strings into a single StringBuilder, with commas between successive elements.
static java.lang.String filePathToTemplatePath(java.lang.String p_path)
          Convert a path using the systems path separator into a /-separated path.
static java.lang.String hexify4(int p_int)
          Compute the 4-digit hexidecimal represenation of an integer between 0 and 0xFFFF.
static boolean isGeneratedClassFilename(java.lang.String p_className, java.lang.String p_fileName)
          Determine if the given file name could be part of a given class.
static java.lang.String templatePathToClassName(java.lang.String p_path)
          Convert a /-separated path into a class name.
static java.lang.String templatePathToFileDir(java.lang.String p_path)
          Return the directory part of a template path, in filesystem format (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

templatePathToFileDir

public static java.lang.String templatePathToFileDir(java.lang.String p_path)
Return the directory part of a template path, in filesystem format (i.e. using File.separator).

Parameters:
p_path - the template path
Returns:
the name of the directory part of that path

isGeneratedClassFilename

public static boolean isGeneratedClassFilename(java.lang.String p_className,
                                               java.lang.String p_fileName)
Determine if the given file name could be part of a given class. A file is considered part of a class if it is either the class file for the class, or the class file for an inner class of the class.

Parameters:
p_className - the class name
p_fileName - the file name
Returns:
true if the named file is part of a class

templatePathToClassName

public static java.lang.String templatePathToClassName(java.lang.String p_path)
Convert a /-separated path into a class name.

Parameters:
p_path - the /-separated path
Returns:
the class name

classToTemplatePath

public static java.lang.String classToTemplatePath(java.lang.Class<?> p_class)
Compute the /-separated path for a given class.

Parameters:
p_class - the class
Returns:
the /-separated path

filePathToTemplatePath

public static java.lang.String filePathToTemplatePath(java.lang.String p_path)
Convert a path using the systems path separator into a /-separated path.

Parameters:
p_path - an OS-specific path
Returns:
a /-separated path

classNameToFilePath

public static java.lang.String classNameToFilePath(java.lang.String p_className)
Construct the relative path to a class file on the file system for a given class, without the ".class" suffix.

Parameters:
p_className - the class name
Returns:
a relative path to the class file on the native file system

capitalize

public static java.lang.String capitalize(java.lang.String p_string)
Capitalize the first letter of a string. If the string is empty, just return an empty string; if it is null, return a null string. string.

Parameters:
p_string - the string
Returns:
p_string with the first letter capitalized

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] bytes)
Convert a byte array into a hexidecimal representation.

Parameters:
bytes - the byte array
Returns:
a hexidecimal representation

hexify4

public static java.lang.String hexify4(int p_int)
Compute the 4-digit hexidecimal represenation of an integer between 0 and 0xFFFF.

Parameters:
p_int - the integer
Returns:
the 4-digit hexidecimal represenation

commaJoin

public static void commaJoin(java.lang.StringBuilder p_builder,
                             java.lang.Iterable<java.lang.String> p_iterable)
Concatenate a list of strings into a single StringBuilder, with commas between successive elements.

Parameters:
p_builder - the builder
p_iterable - the list of strings


jamon