All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ibs.util.EbfUtils

java.lang.Object
   |
   +----ibs.util.EbfUtils

public class EbfUtils
extends Object

Constructor Index

 o EbfUtils()

Method Index

 o isEmpty(String)
 o padString(String, String, int)
 o parseKeyValuePairs(String)
Parses string of following format and converts it into a hashtable.
 o parseKeyValuePairs(String, String)
Parses string of following format and converts it into a hashtable.
 o toBoolean(String)
Convert String into a boolean.
 o toBoolean(String, boolean)
Convert String into a boolean.
 o toInt(String)
Convert String into an int.
 o toInt(String, int)
Convert String into an int.
 o toString(boolean)
Convert boolean into a String
 o toString(int)
Convert an int into the String.
 o toVector(String)
Convert semicolon-seperated list (String) to a String Array.
 o toVector(String, String, String)
Convert list of values (String) to a Vector.
 o toVector(String, String, String, int)
Convert list of values (String) to a String Array.

Constructors

 o EbfUtils
 public EbfUtils()

Methods

 o isEmpty
 public static boolean isEmpty(String s)
 o toInt
 public static int toInt(String s)
Convert String into an int.

 o toInt
 public static int toInt(String s,
                         int default_value)
Convert String into an int.

 o toBoolean
 public static boolean toBoolean(String s)
Convert String into a boolean. If given string does not contain any of following values, it returns default return value 'false'.
YES, TRUE, ENABLE, ENABLED - returns true (case does not matter).
NO, FALSE, DISABLE, DISABLED - returns false (case does not matter).

Parameters:
s - A String to be converted to the boolean value.
Returns:
A boolean value
 o toBoolean
 public static boolean toBoolean(String s,
                                 boolean defaultvalue)
Convert String into a boolean. If given string does not contain any of following values, it returns defaultvalue.
YES, TRUE, ENABLE, ENABLED - returns true (case does not matter).
NO, FALSE, DISABLE, DISABLED - returns false (case does not matter).

Parameters:
s - A String to be converted to the boolean value.
defaultvalue - A boolean default value to be returned if given string did not contain a valid value.
Returns:
A boolean value
 o toString
 public static String toString(boolean b)
Convert boolean into a String

 o toString
 public static String toString(int i)
Convert an int into the String.

 o toVector
 public static Vector toVector(String semicolon_seperated_list)
Convert semicolon-seperated list (String) to a String Array.

Parameters:
s - semicolon_seperated_list A list seperated by semi-colons.
Returns:
A Vector containing all values extracted from the list.
 o toVector
 public static Vector toVector(String list_of_values,
                               String field_separator,
                               String text_qualifier)
Convert list of values (String) to a Vector.

Parameters:
list_of_values - A list of values seperated by field_separator
field_separator - A field separator used in the list values.
text_qualifier - -- This is not available at this time -- Supplied value is IGNORED.
Returns:
A Vector containing all values extracted from the list.
 o toVector
 public static Vector toVector(String list_of_values,
                               String field_separator,
                               String text_qualifier,
                               int max_elements)
Convert list of values (String) to a String Array.

Note: This method is dangerous. It uses StreamTokenizer class which has a bug. It ignores a token if it was null. What I mean is, if your list of values had format of formid,formname,status, but if it looked like formid,,status,, you've got a major problem. StreamTokenizer returns only two tokens formid and status.

Workaround: make sure your record looks likeformid, ,status,.

Parameters:
list_of_values - A list of values seperated by field_separator
field_separator - A field separator used in the list values.
text_qualifier - This parameter is not used at this time -- Supplied value is IGNORED.
max_elements - maximum number of elements to be extracted from the list. Remaining list values will be ignored.
Returns:
A Vector containing all values extracted from the list.
 o padString
 public static String padString(String str,
                                String pad_with,
                                int str_length)
 o parseKeyValuePairs
 public static Hashtable parseKeyValuePairs(String str)
Parses string of following format and converts it into a hashtable.
key1=value1;key2=value2;key3=value3; .......

Parameters:
str - A string containing key value pairs seperated by ; (semi-colon).
Returns:
A hashtable containing keys and values. If no key=values parsed, returns empty hashtable.
 o parseKeyValuePairs
 public static Hashtable parseKeyValuePairs(String str,
                                            String pair_separator)
Parses string of following format and converts it into a hashtable.
For example, key1=value1;key2=value2;key3=value3; ....... ( pairs are seperated using ; )

Parameters:
str - A string containing key value pairs seperated by pair_separator.
Returns:
A hashtable containing keys and values. If no key=values parsed, returns empty hashtable.

All Packages  Class Hierarchy  This Package  Previous  Next  Index