|
JCommon 1.0.17-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.xml.ParserUtil
public class ParserUtil
Basic helper functions to ease up the process of parsing.
Constructor Summary | |
---|---|
ParserUtil()
|
Method Summary | |
---|---|
static Rectangle2D |
getElementPosition(org.xml.sax.Attributes atts)
Parses an element position. |
static boolean |
parseBoolean(String text,
boolean defaultVal)
Parses a boolean. |
static Color |
parseColor(String color)
Parses a color entry. |
static Color |
parseColor(String color,
Color defaultValue)
Parses a color entry. |
static float |
parseFloat(String text,
float defaultVal)
Parses the string text into an float. |
static float |
parseFloat(String text,
String message)
Parses the string text into an float. |
static int |
parseInt(String text,
int defaultVal)
Parses an integer. |
static int |
parseInt(String text,
String message)
Parses the string text into an int. |
static float |
parseRelativeFloat(String value,
String exceptionMessage)
Parses a position of an element. |
static String |
parseString(String text,
String defaultVal)
Parses a string. |
static Stroke |
parseStroke(String weight)
Creates a basic stroke given the width contained as float in the given string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParserUtil()
Method Detail |
---|
public static int parseInt(String text, String message) throws org.xml.sax.SAXException
text
into an int. If text is null or does not
contain a parsable value, the message given in message
is used to
throw a SAXException.
text
- the text to parse.message
- the error message if parsing fails.
org.xml.sax.SAXException
- if there is a problem with the parsing.public static int parseInt(String text, int defaultVal)
text
- the text to parse.defaultVal
- the default value.
public static float parseFloat(String text, String message) throws org.xml.sax.SAXException
text
into an float. If text is null or does not
contain a parsable value, the message given in message
is used to
throw a SAXException.
text
- the text to parse.message
- the error message if parsing fails.
org.xml.sax.SAXException
- if there is a problem with the parsing.public static float parseFloat(String text, float defaultVal)
text
into an float. If text is null or does not
contain a parsable value, the message given in message
is used to
throw a SAXException.
text
- the text to parse.defaultVal
- the defaultValue returned if parsing fails.
public static boolean parseBoolean(String text, boolean defaultVal)
text
contains the value of "true", the
true value is returned, else false is returned.
text
- the text to parse.defaultVal
- the default value.
public static String parseString(String text, String defaultVal)
text
is null, defaultval is returned.
text
- the text to parse.defaultVal
- the default value.
public static Stroke parseStroke(String weight)
weight
- a string containing a number (the stroke weight).
public static Color parseColor(String color)
As fallback the color black is returned if no color can be parsed.
color
- the color (as a string).
public static Color parseColor(String color, Color defaultValue)
As fallback the supplied default value is returned if no color can be parsed.
color
- the color (as a string).defaultValue
- the default value (returned if no color can be parsed).
public static float parseRelativeFloat(String value, String exceptionMessage) throws org.xml.sax.SAXException
value
- the value.exceptionMessage
- the exception message.
org.xml.sax.SAXException
- if there is a problem parsing the string.public static Rectangle2D getElementPosition(org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
atts
- the attributes.
org.xml.sax.SAXException
- if there is a problem getting the element position.
|
JCommon 1.0.17-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |