planetj.common
Class ConvertUtility

java.lang.Object
  |
  +--planetj.common.BusinessObject
        |
        +--planetj.common.ConvertUtility
All Implemented Interfaces:
Invokeable, Serializable

public class ConvertUtility
extends BusinessObject

This type was created in VisualAge.

See Also:
Serialized Form

Constructor Summary
ConvertUtility()
           
 
Method Summary
static String addApostrophes(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 BigDecimal convertNumberToBigDecimal(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 String[] convertToStringArray(List stringList)
          Creates a String[] from the given List containing Strings.
static int get4DigitYear(Date pDate)
          Return the 4 digit year part of a date for example 2002-01-01 would be returned as 2002
static int getCentury(Date pDate)
          Return the century part of a date, for example 2002-01-01 in this context has a century of 20.
static Date getDate(int pYr, int pMonth, int pDay)
          Return the Date based on ints for 4 digit year, month and day
static 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(Date pDate)
          Return the day part of a date
static int getMonth(Date pDate)
          Return the month part of a date
static String getStringSpacedOutTo(int pSize, Object obj)
          Return a String spaced out to the specified length with either spaces of 0 if it is numberic
static int getTime(Date pDate)
          Returns the time portion of the date as a 6 or 5 digit number in the form of HHMMSS.
static int getYear(Date pDate)
          Return the 2 digit year part of a date for example 2002-01-01 would be returned as 2
static String insertLeadingZeros(String value, int length)
          Insert the method's description here.
static String replace(String pString, String pOldValue, String pNewValue)
          Replace each occurance of string pOldValue with string pNewValue and return the resulting string
static ConvertUtility singleton()
           
static Vector subString(String val, int length)
          Take a String and convert it to a Vector of Strings by substring the specified length
static 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertUtility

public ConvertUtility()
Method Detail

addApostrophes

public static String addApostrophes(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 BigDecimal convertNumberToBigDecimal(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

convertToStringArray

public static String[] convertToStringArray(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.

get4DigitYear

public static int get4DigitYear(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(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 Date getDate(int pYr,
                           int pMonth,
                           int pDay)
Return the Date based on ints for 4 digit year, month and day


getDate

public static 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(Date pDate)
Return the day part of a date


getMonth

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


getStringSpacedOutTo

public static String getStringSpacedOutTo(int pSize,
                                          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(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(Date pDate)
Return the 2 digit year part of a date for example 2002-01-01 would be returned as 2


insertLeadingZeros

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


replace

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


singleton

public static ConvertUtility singleton()

subString

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


toHTMLString

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