com.togethersoft.openapi.util.properties
Class PropertyUtil


public class PropertyUtil

This class contains utility static methods.

Author:
TogetherSoft
Since: Together 4.0

Field Summary
 private final static String[][]BOOLEAN_PAIRS
           
 private final static StringNAME_SEPARATOR
           
 private final static charNAME_SEPARATOR_CHAR
           

Method Summary
 static Stringascii2esc(String val)
          Translates ASCII chars to escaped sequences
 static StringdotSubstring(String s, int start, int end)
          Removes a first 'word' of string (words are separated by NAME_SEPARATOR character.
 static StringdotSubstring(String s, int start)
          Removes a first 'word' of string (words are separated by NAME_SEPARATOR character.
 static Stringesc2ascii(String val)
          Translates all escaped sequences to ASCII chars
 static StringfromLangBoolean(Boolean value, String currentValue, String defaultValue)
          Returns a string representation of Boolean.
 static booleangetBoolean(String value, boolean defaultValue)
          Returns a boolean value of String.
 static intgetInt(String value, int defaultValue)
          Returns an integer value of String.
 static BooleangetLangBoolean(String value, Boolean defaultValue)
          Returns a Boolean value of String.
 static StringgetString(String value)
           
 private static StringtranslateEscapes(String original)
           
 static intwordCount(String str)
          Returns the number of substrings separated by the NAME_SEPARATOR
character in the string.
 static intwordStartIndex(String s, int n)
          Returns the position of NAME_SEPARATOR character in the string
(-1 if not found).

Field Detail

BOOLEAN_PAIRS

private final static String[][] BOOLEAN_PAIRS

NAME_SEPARATOR

private final static String NAME_SEPARATOR

NAME_SEPARATOR_CHAR

private final static char NAME_SEPARATOR_CHAR
Method Detail

ascii2esc

public static String ascii2esc(String val)
Translates ASCII chars to escaped sequences

dotSubstring

public static String dotSubstring(String s, int start, int end)
Removes a first 'word' of string (words are separated by NAME_SEPARATOR character.
Parameters:
s the string
start start index
end end index

dotSubstring

public static String dotSubstring(String s, int start)
Removes a first 'word' of string (words are separated by NAME_SEPARATOR character.
Parameters:
s the string
start start index

esc2ascii

public static String esc2ascii(String val)
Translates all escaped sequences to ASCII chars

fromLangBoolean

public static String fromLangBoolean(Boolean value, String currentValue, String defaultValue)
Returns a string representation of Boolean. There are several types of
representation : "yes"/"no", "true"/"false", "on/off".
Parameters:
value the Boolean instance
currentValue if not null it is used to select the type of represenation
defaultValue returned if value is null.

getBoolean

public static boolean getBoolean(String value, boolean defaultValue)
Returns a boolean value of String.

getInt

public static int getInt(String value, int defaultValue)
Returns an integer value of String.

getLangBoolean

public static Boolean getLangBoolean(String value, Boolean defaultValue)
Returns a Boolean value of String.

getString

public static String getString(String value)

translateEscapes

private static String translateEscapes(String original)

wordCount

public static int wordCount(String str)
Returns the number of substrings separated by the NAME_SEPARATOR
character in the string.

wordStartIndex

public static int wordStartIndex(String s, int n)
Returns the position of NAME_SEPARATOR character in the string
(-1 if not found).

Association Links

to Class java.lang.String