Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.utils
Class CommonUtils

    java.lang.Object
      org.jasig.portal.utils.CommonUtils

    public class CommonUtils

extends java.lang.Object

CommonUtils class contains base useful utilities

Version:
  $Revision: 1.16 $
Author:
  Michael Ivanov

Constructor Summary
`CommonUtils()`

Method Summary
`static java.lang.String` | `boolToStr(boolean bool)` This method returns the String representation of the given boolean value.
`static java.lang.String` | `envl(java.lang.String sourceStr, java.lang.String replaceStr)` Replaces "sourceString" with "replaceString" if sourceString is null or empty
`static boolean[]` | `getFamilyPropertyArrayBoolean(java.util.Hashtable hash, java.lang.String[] keys, java.lang.String propName)`
`static boolean[]` | `getFamilyPropertyArrayBoolean(java.util.Hashtable hash, java.lang.String[] keys, java.lang.String propName, boolean def)`
`static int[]` | `getFamilyPropertyArrayInt(java.util.Hashtable hash, java.lang.String[] keys, java.lang.String propName)`
`static java.lang.String[]` | `getFamilyPropertyArrayString(java.util.Hashtable hash, java.lang.String[] keys, java.lang.String propName)`
`static java.lang.String[]` | `getFamilyPropertyArrayString(java.util.Hashtable hash, java.lang.String[] keys, java.lang.String propName, java.lang.String def)`
`static java.lang.String[]` | `getFamilyPropertyArrayString(java.util.Hashtable hash, java.lang.String[] keys, java.lang.String propName, java.lang.String[] def)`
`static java.lang.String` | `getFamilyPropertyString(java.util.Hashtable hash, java.lang.String key, java.lang.String propName, java.lang.String def)`
`static java.util.Hashtable` | `getFamilyProps(java.util.Properties props, java.lang.String prefix, java.lang.String delim, java.util.Properties defaultProps)`
`static int[]` | `getSplitIntByCommas(java.lang.String str, java.lang.String delim, int def)` This method gets a properties of int from given string splitted by commas.
`static java.lang.String[]` | `getSplitStringByCommas(java.lang.String str, java.lang.String delim)` This method gets an array of strings from given string splitted by commas.
`static java.util.Properties` | `getSplitStringByCommas(java.lang.String keys, java.lang.String values, java.lang.String delim)` This method gets a properties of strings from given string splitted by commas.
`static boolean` | `isArrayEmpty(java.lang.Object[] objects)` This method checks if an array of objects is empty or not.
`static boolean` | `isArrayEmpty(java.lang.String[] objects)` This method checks if an array of strings is empty or not.
`static java.lang.String` | `nvl(java.lang.String sourceStr)` Replaces "sourceString" with "" if sourceString equals null
`static java.lang.String` | `nvl(java.lang.String sourceStr, java.lang.String replaceStr)` Replaces "sourceString" with "replaceString" if sourceString equals null
`static java.lang.String` | `nvl(java.lang.String sourceStr, java.lang.String replaceStr, java.lang.String prefix)` Replaces "sourceString" with "replaceString" if sourceString equals null
`static boolean` | `odd(int i)`
`static boolean` | `parseBoolean(java.lang.String str)` This method returns the boolean value for the given String representation ("yes"-"no").
`static boolean` | `parseBoolean(java.lang.String str, boolean defaultValue)`
`static int` | `parseInt(java.lang.String str)`
`static int` | `parseInt(java.lang.String str, int defaultValue)`
`static void` | `replaceSubstVariables(java.util.Hashtable original, java.util.Hashtable subst)`
`static java.lang.String` | `replaceText(java.lang.String text, java.lang.String replacedString, java.lang.String newString)` replaces "replacedString" with "newString" in "text"
`static void` | `setNoCache(javax.servlet.http.HttpServletResponse res)` Sets "no cache" directives to the given response
`static java.lang.String` | `stackTraceToString(java.lang.Exception e)`
`static boolean` | `strToBool(java.lang.String bool)` This method returns the boolean value for the given String representation ("true"-"false").

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CommonUtils

    public CommonUtils()

Method Detail

### setNoCache

    public static void setNoCache(javax.servlet.http.HttpServletResponse res)

  Sets "no cache" directives to the given response

  Parameters:
    `res` - `HttpServletResponse` response

### nvl

    public static java.lang.String nvl(java.lang.String sourceStr,
                                       java.lang.String replaceStr)

  Replaces "sourceString" with "replaceString" if sourceString equals null

  Parameters:
    `sourceStr` - the string to replace
    `replaceStr` - the replacement string
  Returns:
    the processed string

### envl

    public static java.lang.String envl(java.lang.String sourceStr,
                                        java.lang.String replaceStr)

  Replaces "sourceString" with "replaceString" if sourceString is null or empty

  Parameters:
    `sourceStr` - the string to replace
    `replaceStr` - the replacement string
  Returns:
    the processed string

### nvl

    public static java.lang.String nvl(java.lang.String sourceStr,
                                       java.lang.String replaceStr,
                                       java.lang.String prefix)

  Replaces "sourceString" with "replaceString" if sourceString equals null

  Parameters:
    `sourceStr` - the string to replace
    `replaceStr` - the replacement string
    `prefix` - the prefix
  Returns:
    the processed string

### nvl

    public static java.lang.String nvl(java.lang.String sourceStr)

  Replaces "sourceString" with "" if sourceString equals null

  Parameters:
    `sourceStr` - string to replace
  Returns:
    the processed string

### replaceText

    public static java.lang.String replaceText(java.lang.String text,
                                               java.lang.String replacedString,
                                               java.lang.String newString)

  replaces "replacedString" with "newString" in "text"

  Parameters:
    `text` - text where to replace
    `replacedString` - string to replace
    `newString` - new string
  Returns:
    new text

### replaceSubstVariables

    public static void replaceSubstVariables(java.util.Hashtable original,
                                             java.util.Hashtable subst)

### stackTraceToString

    public static java.lang.String stackTraceToString(java.lang.Exception e)

### getSplitStringByCommas

    public static java.lang.String[] getSplitStringByCommas(java.lang.String str,
                                                            java.lang.String delim)

  This method gets an array of strings from given string splitted by commas.

  Parameters:
    `str` - a string value
    `delim` - a delimeter
  Returns:
    an array of strings

### getSplitStringByCommas

    public static java.util.Properties getSplitStringByCommas(java.lang.String keys,
                                                              java.lang.String values,
                                                              java.lang.String delim)

  This method gets a properties of strings from given string splitted by commas.

  Parameters:
    `keys` - a string keys for properties
    `values` - a string value
    `delim` - a delimeter
  Returns:
    an array of strings

### getSplitIntByCommas

    public static int[] getSplitIntByCommas(java.lang.String str,
                                            java.lang.String delim,
                                            int def)

  This method gets a properties of int from given string splitted by commas.

  Parameters:
    `str` - a string keys for properties
    `delim` - a delimeter
    `def` - a default value
  Returns:
    an array of int

### getFamilyProps

    public static java.util.Hashtable getFamilyProps(java.util.Properties props,
                                                     java.lang.String prefix,
                                                     java.lang.String delim,
                                                     java.util.Properties defaultProps)

### getFamilyPropertyArrayString

    public static java.lang.String[] getFamilyPropertyArrayString(java.util.Hashtable hash,
                                                                  java.lang.String[] keys,
                                                                  java.lang.String propName,
                                                                  java.lang.String[] def)

### getFamilyPropertyString

    public static java.lang.String getFamilyPropertyString(java.util.Hashtable hash,
                                                           java.lang.String key,
                                                           java.lang.String propName,
                                                           java.lang.String def)

### getFamilyPropertyArrayString

    public static java.lang.String[] getFamilyPropertyArrayString(java.util.Hashtable hash,
                                                                  java.lang.String[] keys,
                                                                  java.lang.String propName,
                                                                  java.lang.String def)

### getFamilyPropertyArrayString

    public static java.lang.String[] getFamilyPropertyArrayString(java.util.Hashtable hash,
                                                                  java.lang.String[] keys,
                                                                  java.lang.String propName)

### getFamilyPropertyArrayBoolean

    public static boolean[] getFamilyPropertyArrayBoolean(java.util.Hashtable hash,
                                                          java.lang.String[] keys,
                                                          java.lang.String propName,
                                                          boolean def)

### getFamilyPropertyArrayBoolean

    public static boolean[] getFamilyPropertyArrayBoolean(java.util.Hashtable hash,
                                                          java.lang.String[] keys,
                                                          java.lang.String propName)

### getFamilyPropertyArrayInt

    public static int[] getFamilyPropertyArrayInt(java.util.Hashtable hash,
                                                  java.lang.String[] keys,
                                                  java.lang.String propName)

### parseBoolean

    public static boolean parseBoolean(java.lang.String str,
                                       boolean defaultValue)

### boolToStr

    public static java.lang.String boolToStr(boolean bool)

  This method returns the String representation of the given boolean value.

  Parameters:
    `bool` - a value of boolean type
  Returns:
    "true" if bool is true, "false" - otherwise

### strToBool

    public static boolean strToBool(java.lang.String bool)

  This method returns the boolean value for the given String representation ("true"-"false").

  Parameters:
    `bool` - a `String` value
  Returns:
    true if bool is "true", false - otherwise

### parseBoolean

    public static boolean parseBoolean(java.lang.String str)

  This method returns the boolean value for the given String representation ("yes"-"no").

  Parameters:
    `str` - a `String` value
  Returns:
    true if str is "yes", false - otherwise

### parseInt

    public static int parseInt(java.lang.String str,
                               int defaultValue)

### parseInt

    public static int parseInt(java.lang.String str)

### odd

    public static boolean odd(int i)

### isArrayEmpty

    public static boolean isArrayEmpty(java.lang.Object[] objects)

  This method checks if an array of objects is empty or not.

  Parameters:
    `objects` - an array of objects
  Returns:
    true if array is empty, false - otherwise

### isArrayEmpty

    public static boolean isArrayEmpty(java.lang.String[] objects)

  This method checks if an array of strings is empty or not.

  Parameters:
    `objects` - an array of strings
  Returns:
    true if array is empty, false - otherwise

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD