planetj.common
Class ConvertUtility

java.lang.Object
  extended byplanetj.common.BusinessObject
      extended byplanetj.common.ConvertUtility
All Implemented Interfaces:
Invokeable, java.io.Serializable

public class ConvertUtility
extends BusinessObject

This type was created in VisualAge.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class planetj.common.BusinessObject
methodHashTable
 
Constructor Summary
ConvertUtility()
           
 
Method Summary
static java.lang.String addApostrophes(java.lang.String value)
          This method adds an additional apostrophe into contractions to satisfy an SQL statement An example would be: "can't" becomes "can''t".
static java.util.Map convertKeyValueStringToMap(java.lang.String keyValueString, char keySplitter, char valueSplitter)
          Converts the given string containing key value pairs separated by a character.
static java.util.Map convertKeyValueStringToMap(java.lang.String keyValueString, char keySplitter, char valueSplitter, boolean uppercaseKey)
          Converts the given string containing key value pairs separated by a character.
static java.util.List convertListValueStringToList(java.lang.String listValueString, char listSplitter, char fieldSplitter)
          Converts the given string containing a list with another list seperated by a special character.
static java.math.BigDecimal convertNumberToBigDecimal(java.lang.Number pNumber)
          Takes a java.lang.Number and returns a java.math.BigDecimal that has the BigDecimal form of the value in the Number.
static double convertToDouble(java.lang.String value)
          Converts the given String to a double.
static java.lang.String[] convertToStringArray(java.util.List stringList)
          Creates a String[] from the given List containing Strings.
static java.util.List convertValueStringToList(java.lang.String valueString, char valueSplitter)
          Converts the given string containing values separated by a character to a List
static int get4DigitYear(java.util.Date pDate)
          Return the 4 digit year part of a date for example 2002-01-01 would be returned as 2002
static int getCentury(java.util.Date pDate)
          Return the century part of a date, for example 2002-01-01 in this context has a century of 20.
static java.util.Date getDate(int pYr, int pMonth, int pDay)
          Return the Date based on ints for 4 digit year, month and day
static java.util.Date getDate(int pCentry, int pYr, int pMonth, int pDay)
          Return the Date based on ints for century, year, month and day
static int getDay(java.util.Date pDate)
          Return the day part of a date
static int getMonth(java.util.Date pDate)
          Return the month part of a date
static java.lang.String getStringSpacedOutTo(int pSize, java.lang.Object obj)
          Return a String spaced out to the specified length with either spaces of 0 if it is numberic
static int getTime(java.util.Date pDate)
          Returns the time portion of the date as a 6 or 5 digit number in the form of HHMMSS.
static int getYear(java.util.Date pDate)
          Return the 2 digit year part of a date for example 2002-01-01 would be returned as 2
static java.lang.String insertLeadingZeros(java.lang.String value, int length)
          Insert the method's description here.
static java.lang.String replace(java.lang.String pString, java.lang.String pOldValue, java.lang.String pNewValue)
          Replace each occurance of string pOldValue with string pNewValue and return the resulting string
static ConvertUtility singleton()
           
static java.util.Vector subString(java.lang.String val, int length)
          Take a String and convert it to a Vector of Strings by substring the specified length
static java.lang.String toHTMLString(int value)
          Converts a number to an HTML-safe string
 
Methods inherited from class planetj.common.BusinessObject
generateException, generateException, generateException, generateException, generateException, getTranslation, invoke, toBoolean, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertUtility

public ConvertUtility()
Method Detail

addApostrophes

public static java.lang.String addApostrophes(java.lang.String value)
This method adds an additional apostrophe into contractions to satisfy an SQL statement An example would be: "can't" becomes "can''t". Creation date: (11/30/2001 12:09:14 PM)

Parameters:
value - java.lang.String
Returns:
java.lang.String

convertNumberToBigDecimal

public static java.math.BigDecimal convertNumberToBigDecimal(java.lang.Number pNumber)
Takes a java.lang.Number and returns a java.math.BigDecimal that has the BigDecimal form of the value in the Number.

Parameters:
pNumber - java.lang.Number
Returns:
java.math.BigDecimal

convertValueStringToList

public static java.util.List convertValueStringToList(java.lang.String valueString,
                                                      char valueSplitter)
Converts the given string containing values separated by a character to a List

Parameters:
valueString - String containing values
valueSplitter - character that denotes the starting the key value pair's value

convertKeyValueStringToMap

public static java.util.Map convertKeyValueStringToMap(java.lang.String keyValueString,
                                                       char keySplitter,
                                                       char valueSplitter)
Converts the given string containing key value pairs separated by a character.

Parameters:
keyValueString - String containing key value pairs
keySplitter - character that denotes the starting of a new key value pair
valueSplitter - character that denotes the starting the key value pair's value

convertKeyValueStringToMap

public static java.util.Map convertKeyValueStringToMap(java.lang.String keyValueString,
                                                       char keySplitter,
                                                       char valueSplitter,
                                                       boolean uppercaseKey)
Converts the given string containing key value pairs separated by a character.

Parameters:
keyValueString - String containing key value pairs
keySplitter - character that denotes the starting of a new key value pair
valueSplitter - character that denotes the starting the key value pair's value
uppercaseKey - whether or not the key should be uppercased

convertListValueStringToList

public static java.util.List convertListValueStringToList(java.lang.String listValueString,
                                                          char listSplitter,
                                                          char fieldSplitter)
Converts the given string containing a list with another list seperated by a special character.


convertToStringArray

public static java.lang.String[] convertToStringArray(java.util.List stringList)
                                               throws CMException
Creates a String[] from the given List containing Strings.

Parameters:
stringList - List of Strings
Throws:
CMException - thrown when given List doesn't contain all Strings.

convertToDouble

public static double convertToDouble(java.lang.String value)
                              throws CMException
Converts the given String to a double. Serves as a convienct method for removing comma's from the given String to prevent a NumberFormatException from occuring when attempting to convert.

Throws:
CMException

get4DigitYear

public static int get4DigitYear(java.util.Date pDate)
Return the 4 digit year part of a date for example 2002-01-01 would be returned as 2002


getCentury

public static int getCentury(java.util.Date pDate)
Return the century part of a date, for example 2002-01-01 in this context has a century of 20. We use this to build the date later.


getDate

public static java.util.Date getDate(int pYr,
                                     int pMonth,
                                     int pDay)
Return the Date based on ints for 4 digit year, month and day


getDate

public static java.util.Date getDate(int pCentry,
                                     int pYr,
                                     int pMonth,
                                     int pDay)
Return the Date based on ints for century, year, month and day


getDay

public static int getDay(java.util.Date pDate)
Return the day part of a date


getMonth

public static int getMonth(java.util.Date pDate)
Return the month part of a date


getStringSpacedOutTo

public static java.lang.String getStringSpacedOutTo(int pSize,
                                                    java.lang.Object obj)
Return a String spaced out to the specified length with either spaces of 0 if it is numberic


getTime

public static int getTime(java.util.Date pDate)
Returns the time portion of the date as a 6 or 5 digit number in the form of HHMMSS. For example, 3:00:00 PM would be represented by 150000. 4:15:23 AM would be represented by 41523.


getYear

public static int getYear(java.util.Date pDate)
Return the 2 digit year part of a date for example 2002-01-01 would be returned as 2


insertLeadingZeros

public static java.lang.String insertLeadingZeros(java.lang.String value,
                                                  int length)
Insert the method's description here. Creation date: (11/6/2001 1:24:41 PM)


replace

public static java.lang.String replace(java.lang.String pString,
                                       java.lang.String pOldValue,
                                       java.lang.String pNewValue)
Replace each occurance of string pOldValue with string pNewValue and return the resulting string


singleton

public static ConvertUtility singleton()

subString

public static java.util.Vector subString(java.lang.String val,
                                         int length)
Take a String and convert it to a Vector of Strings by substring the specified length


toHTMLString

public static java.lang.String toHTMLString(int value)
Converts a number to an HTML-safe string