net.windward.util
Class StringTagFormatter
java.lang.Object
|
+--net.windward.util.StringTagFormatter
- public class StringTagFormatter
- extends java.lang.Object
- Version:
- 1.0 Jun 12, 2004
|
Method Summary |
static java.lang.String |
dataToRaw(java.lang.String nodeText,
java.lang.String textType,
java.lang.String inPattern,
java.util.Locale locale)
Returns the nodeText as raw data, converted as requested by the attributes. |
static java.lang.String |
rawToText(java.lang.String nodeText,
java.lang.String textPattern,
java.util.Locale locale)
Returns the raw text, converted as requested by the attributes. |
static java.lang.String |
rawToText(java.lang.String nodeText,
java.lang.String textType,
java.lang.String outPattern,
java.util.Locale locale)
Returns the raw text, converted as requested by the attributes. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringTagFormatter
public StringTagFormatter()
dataToRaw
public static java.lang.String dataToRaw(java.lang.String nodeText,
java.lang.String textType,
java.lang.String inPattern,
java.util.Locale locale)
- Returns the nodeText as raw data, converted as requested by the attributes. The default operation is to
return nodeText.
There are several attempts to parse the input string. For a number/currency/percent, it first attempts to
parse the string using the appropiate NumberFormat.parse() method and using NumberFormat.applyPattern(). If
this fails, it then tries Double.parseDouble(). If that fails it will then throw NodeFormatException.
For date/time/both it makes three passes when attempting to parse. First it will try DateFormat.parse() using
DateFormat.applyPattern(). If that fails, it will try in order DateFormat.parse() using the patterns FULL,
LONG, MEDIUM, and SHORT without using applyPattern(). If that fails it will assume nodeText is a long and
try Date (Long.parseLong()). If it is not a long, it will throw a NumberFormatException.
- Parameters:
nodeText - The text in a xml node.textType - The value NUMBER, CURRENCY, PERCENT, BITMAP, or "".inPattern - The input pattern (see SimpleDateFormat or NumberFormat). Set to "" if none.locale - The local used for parsing and displaying the text.- Returns:
- The passed in text converted as requested.
- Throws:
java.lang.NumberFormatException - thrown if cannot parse the nodeText.
rawToText
public static java.lang.String rawToText(java.lang.String nodeText,
java.lang.String textPattern,
java.util.Locale locale)
- Returns the raw text, converted as requested by the attributes. The default operation is to return nodeText.
- Parameters:
nodeText - The text in a xml node.textPattern - The text type - NUMBER, DATE, etc., optionally followed by "-pattern".locale - The local used for parsing and displaying the text.- Returns:
- The passed in text converted as requested.
- Throws:
java.lang.NumberFormatException - thrown if cannot parse the nodeText.
rawToText
public static java.lang.String rawToText(java.lang.String nodeText,
java.lang.String textType,
java.lang.String outPattern,
java.util.Locale locale)
- Returns the raw text, converted as requested by the attributes. The default operation is to return nodeText.
- Parameters:
nodeText - The text in a xml node.textType - The text type - NUMBER, DATE, etc.outPattern - The pattern to be passed to the date/time formatter. Pass "" for none. This can be SHORT, etc.locale - The local used for parsing and displaying the text.- Returns:
- The passed in text converted as requested.
- Throws:
java.lang.NumberFormatException - thrown if cannot parse the nodeText.
Copyright © 2002 - 2008 Windward Reports - All Rights Reserved. java reporting software