org.strutsme.common.serialization
Class SerializeTools

java.lang.Object
  extended by org.strutsme.common.serialization.SerializeTools

public final class SerializeTools
extends java.lang.Object

SerializeTools contains from tool string methods which are used by the Serializer class.

Author:
lbusmann

Method Summary
static java.lang.String convertDateToStringFormatted(java.util.Date o)
          Convert a Date to a string by using its structured values (year, month, day, hour, minute, second and millisecond) represention.
static java.lang.String convertDateToStringUnformatted(java.util.Date o)
          Convert a Date to a string by using its ms-as-long represention.
static java.util.Date convertStringToDateFormatted(java.lang.String stringValue)
          Convert a String into a Date.
static java.util.Date convertStringToDateUnformatted(java.lang.String stringValue)
          Convert a String into a Date.
static java.util.Vector explode(java.lang.String string, char seperator)
          Splits the string at the given seperator into multiple strings and returns these as a Vector. explode will not split if the seperator is prefixed by the escape char.
static java.lang.String implode(java.lang.String[] strs, char seperator)
          Joins the given strings and the seperator into a single string. implode will wrap the input strings: occourances of the seperator are replaced by escape char plus the seperator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

explode

public static java.util.Vector explode(java.lang.String string,
                                       char seperator)
Splits the string at the given seperator into multiple strings and returns these as a Vector. explode will not split if the seperator is prefixed by the escape char. Also the resulting strings are unwrapped: occurances of escape char plus the seperator are replaced by the seperator. So explode("a:b\:c:d", ':') return ["a", "b:c", "d"].

Parameters:
string - the source string to split
seperator - the special character which is used as seperator
Returns:
the resulting strings

implode

public static java.lang.String implode(java.lang.String[] strs,
                                       char seperator)
Joins the given strings and the seperator into a single string. implode will wrap the input strings: occourances of the seperator are replaced by escape char plus the seperator. So implode(["a", "b:c", "d"], ':') = "a:b\:c:d".

Parameters:
strs - the source strings
seperator - the special character which is used as seperator
Returns:
the single string

convertDateToStringUnformatted

public static java.lang.String convertDateToStringUnformatted(java.util.Date o)
Convert a Date to a string by using its ms-as-long represention.

Parameters:
o - the date
Returns:
the string

convertStringToDateUnformatted

public static java.util.Date convertStringToDateUnformatted(java.lang.String stringValue)
Convert a String into a Date.

Parameters:
stringValue - the string
Returns:
the date

convertDateToStringFormatted

public static java.lang.String convertDateToStringFormatted(java.util.Date o)
Convert a Date to a string by using its structured values (year, month, day, hour, minute, second and millisecond) represention.

Parameters:
o - the date
Returns:
the string

convertStringToDateFormatted

public static java.util.Date convertStringToDateFormatted(java.lang.String stringValue)
Convert a String into a Date.

Parameters:
stringValue - the string
Returns:
the date