com.jfw.util
Class Miscellaneous

java.lang.Object
  extended by com.jfw.util.Miscellaneous

public final class Miscellaneous
extends java.lang.Object

Various utility methods. All methods are static and thread safe.


Constructor Summary
Miscellaneous()
           
 
Method Summary
static java.lang.String arrayList2String(java.util.ArrayList arrayList)
          Transform an ArrayList of String in String.
static java.lang.String arrayString2String(java.lang.String[] values)
          Transform an array of String.
static java.util.ArrayList getArrayListFromString(java.lang.String toElaborate, java.lang.String separator)
          Get an ArrayList from a String.
static java.util.ArrayList getArrayListFromStringArray(java.lang.String[] toElaborate)
          Get an ArrayList from an array of Strings.
static java.lang.String[] getStringArrayFromArrayList(java.util.ArrayList toElaborate)
          Get an array of Strings from an ArrayList.
static java.lang.String getTimeExtension()
          Deprecated. moved in DateUtils
static java.lang.String getTimeExtension(long date)
          Deprecated. moved in DateUtils
static java.util.Vector getVectorFromString(java.lang.String toElaborate, java.lang.String separator)
          Get a Vector from a String.
static java.util.Vector getVectorFromStringArray(java.lang.String[] toElaborate)
          Get a Vector from an array of Strings.
static java.lang.String stackTrace(java.lang.Exception exception)
          Get as a string a stack trace.
static java.util.ArrayList stackTrace(int remove)
          Get an ArrayList with the lines of a stack trace.
static java.lang.String stackTrace(java.lang.Throwable throwable)
          Get as a string a stack trace.
static java.lang.String[] transformDate(java.lang.String dateTime)
          Deprecated. moved in DateUtils
static java.lang.String vector2String(java.util.Vector vector)
          Transform a Vector of String in String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Miscellaneous

public Miscellaneous()
Method Detail

stackTrace

public static final java.util.ArrayList stackTrace(int remove)
                                            throws java.lang.Exception
Get an ArrayList with the lines of a stack trace.

Parameters:
remove - number of rows from the stack trace to skeep.
Returns:
an ArryList of the lines of a stack trace.
Throws:
java.lang.Exception

stackTrace

public static final java.lang.String stackTrace(java.lang.Exception exception)
Get as a string a stack trace.

Parameters:
exception - the exception to elaborate.
Returns:
a string with the stack trace.

stackTrace

public static final java.lang.String stackTrace(java.lang.Throwable throwable)
Get as a string a stack trace.

Parameters:
throwable - the throwable to elaborate.
Returns:
a string with the stack trace.

vector2String

public static final java.lang.String vector2String(java.util.Vector vector)
Transform a Vector of String in String.

Parameters:
vector - a Vector object.
Returns:
the substrings are separated by |.

arrayList2String

public static final java.lang.String arrayList2String(java.util.ArrayList arrayList)
Transform an ArrayList of String in String.

Parameters:
arrayList - an ArrayList object.
Returns:
the substrings are separated by |.

arrayString2String

public static final java.lang.String arrayString2String(java.lang.String[] values)
Transform an array of String.

Parameters:
values - an array of String object.
Returns:
the substrings are separated by |.

getTimeExtension

public static final java.lang.String getTimeExtension()
Deprecated. moved in DateUtils

Get a string with format .YYYY-MM-DD.HH-MM-SS. The actuale date and time is used.

Returns:
a string with format .YYYY-MM-DD.HH-MM-SS.

getTimeExtension

public static final java.lang.String getTimeExtension(long date)
Deprecated. moved in DateUtils

Get a string with format .YYYY-MM-DD.HH-MM-SS. The date and time of date is used.

Parameters:
date - a Date.getTime() value.
Returns:
a string with format .YYYY-MM-DD.HH-MM-SS.

transformDate

public static java.lang.String[] transformDate(java.lang.String dateTime)
Deprecated. moved in DateUtils

Get a formated string reppresentation of Date.getTime() string value.

Parameters:
dateTime - string value of Date.getTime().
Returns:
index 0 contains a string HH:MM:SS, index 0 contains a string YYYY-MM-DD.

getVectorFromString

public static java.util.Vector getVectorFromString(java.lang.String toElaborate,
                                                   java.lang.String separator)
Get a Vector from a String.

Parameters:
toElaborate - the string to elaborate.
separator - the string used to separate values in toElaborate.
Returns:
a Vector with the substrings.

getArrayListFromString

public static java.util.ArrayList getArrayListFromString(java.lang.String toElaborate,
                                                         java.lang.String separator)
Get an ArrayList from a String.

Parameters:
toElaborate - the string to elaborate.
separator - the string used to separate values in toElaborate.
Returns:
an ArrayList with the substrings.

getArrayListFromStringArray

public static java.util.ArrayList getArrayListFromStringArray(java.lang.String[] toElaborate)
Get an ArrayList from an array of Strings.

Parameters:
toElaborate - the array string to elaborate.
Returns:
an ArrayList.

getStringArrayFromArrayList

public static java.lang.String[] getStringArrayFromArrayList(java.util.ArrayList toElaborate)
Get an array of Strings from an ArrayList.

Parameters:
toElaborate - the array list to elaborate.
Returns:
an array of Strings.

getVectorFromStringArray

public static java.util.Vector getVectorFromStringArray(java.lang.String[] toElaborate)
Get a Vector from an array of Strings.

Parameters:
toElaborate - the array string to elaborate.
Returns:
a Vector.