|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mome.ext.Utils
public class Utils
Collection of useful static utils for parsing strings.
Field Summary | |
---|---|
static char[] |
testSeparators
Array of separators. |
Constructor Summary | |
---|---|
protected |
Utils()
Protects constructor. |
Method Summary | |
---|---|
static boolean |
isTestSeparator(char c)
Checks if the given character is separator. |
static boolean |
parseBoolean(String arg)
Parses given string and returns true if string is "on" or
"true" false otherwise. |
static int |
parseColor(String arg)
Parses string as hexadecimal integer representation and returns color as integer or -1 if string is null or can't be
parsed. |
static Font |
parseFont(String arg)
Parses string and returns font. |
static int |
parseFontFace(String face)
Parses string and returns fonts face as integer. |
static int |
parseFontSize(String size)
Parses string and returns fonts size as integer. |
static int |
parseFontStyle(String style)
Parses string and returns fonts style as integer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static char[] testSeparators
Constructor Detail |
---|
protected Utils()
Method Detail |
---|
public static boolean parseBoolean(String arg)
true
if string is "on" or
"true" false
otherwise. Tests are case insensitive.
arg
- string to parse.
true
if string is "on" or "true" false
otherwise.public static int parseColor(String arg)
-1
if string is null
or can't be
parsed.
arg
- string to be parsed.
-1
if string is
null
or can't be parsedpublic static int parseFontFace(String face)
PROPRTIONAL | MONOSPACE | SYSTEMto be parsed. Test are case insensitive. Spaces are not allowed.
face
- string to be parsed.
NullPointerException
- if face is null
.
IllegalArgumentException
- if face is not of valid form.public static int parseFontStyle(String style)
(PLAIN|BOLD|ITALIC|UNDERLINED)(;(PLAIN|BOLD|ITALIC|UNDERLINED))*to be parsed. Test are case insensitive. Spaces are not allowed.
style
- string to be parsed.
NullPointerException
- if style is null
.
IllegalArgumentException
- if style is not of valid form.public static int parseFontSize(String size)
LARGE | MEDIUM | SMALLto be parsed. Test are case insensitive. Spaces are not allowed.
size
- string to be parsed.
NullPointerException
- if style is null
;
IllegalArgumentException
- if style is not of valid form.public static Font parseFont(String arg)
<Face>,<Style>,<Size> Face = PROPRTIONAL|MONOSPACE|SYSTEM Style = (PLAIN|BOLD|ITALIC|UNDERLINED)(;(PLAIN|BOLD|ITALIC|UNDERLINED))* Size = LARGE|MEDIUM|SMALLto be parsed. Test are case insensitive. Spaces are not allowed.
arg
- string to be parsed.
null
if string is null
or not of valid form.public static boolean isTestSeparator(char c)
c
- character to be tested.
true
if character is separator, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |