public class BrokerFormat
extends java.lang.Object
:s - sinqle quoting. Enclose the value in <'>, and escape single quotes in the value with a <\> :d - double quotes. Enclose the value in <">, and escape double quotes in the value with <\> :q - SQL quoting. Like :s, but escape with <'> :v - Bind variable mode. Primarly intended for use with databases, Replace the reference with a proper bind variable placeholder. Default is Oracle style, as in :v0, :v1, :v2. Can be changed to use with the setFormatMode() call. :c - numeric. Use value as numeric value. If value is non-numeric, any non-numeric portions will be discarded. I.e. if the value is "123X", only "123" will be used in the result. :###x - Specify a minimum field length together with one of the options above, i.e. <:5d> will print a value of'\' can be used to escape the following character outside of variable names. To get a '$' character into the result, escape it with a '\', i.e. \\\a\$foo will be returned as \a$fooas <'AB '>.
Modifier and Type | Field and Description |
---|---|
protected static char |
modeV |
Constructor and Description |
---|
BrokerFormat(java.lang.String format_string)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
assemble(BrokerEvent event,
java.util.Vector tokens)
Assemble a string from the tokens, replacing references with values from the event.
|
static java.lang.String |
assemble(BrokerEvent event,
java.util.Vector tokens,
java.util.Locale locale)
Assemble a string from the tokens, replacing references with values from the event.
|
static java.lang.String |
assemble(java.util.Vector tokens)
Assemble a string from the tokens, without an event reference.
|
java.lang.String |
format()
Return formatted string, without event data.
|
java.lang.String |
format(BrokerEvent event)
Return formatted string, using
|
java.lang.String |
format(BrokerEvent event,
java.util.Locale locale)
Return formatted string, using
|
static java.lang.String |
format(BrokerEvent event,
java.lang.String format_string)
Format an event using a format string.
|
static java.lang.String |
format(BrokerEvent event,
java.lang.String format_string,
java.util.Locale locale)
Format an event using a format string.
|
java.lang.String |
formatBindVariable(int index,
java.lang.StringBuffer place_holder_name)
Returns the name of the bind variable at token
|
int |
getTokenCount()
Returns the number of tokens.
|
java.lang.String |
getTokenValue(int t)
Return the value of a token.
|
boolean |
isReferenceToken(int t)
Checks if a token is a reference to an event field.
|
static java.util.Vector<COM.activesw.api.client.BrokerFormatToken> |
preparse(java.lang.String format_string)
Take a string, and break it up into a list of tokens.
|
static boolean |
setFormatMode(java.lang.String format_option,
java.lang.String mode)
set the mode for a format option (see above).
|
public BrokerFormat(java.lang.String format_string)
format_string
- ...
public int getTokenCount()
public boolean isReferenceToken(int t)
t
- token numberpublic java.lang.String getTokenValue(int t)
t
- token numberpublic java.lang.String format()
public java.lang.String format(BrokerEvent event) throws BrokerException
event
- the event for the dataBrokerException
public java.lang.String format(BrokerEvent event, java.util.Locale locale) throws BrokerException
event
- the event for the datalocale
- determines format of field value outputBrokerException
public static boolean setFormatMode(java.lang.String format_option, java.lang.String mode)
public static java.lang.String format(BrokerEvent event, java.lang.String format_string) throws BrokerException
format(event, format_string, java.util.Locale.US)
event
- the event for the dataformat_string
- the format stringBrokerException
public static java.lang.String format(BrokerEvent event, java.lang.String format_string, java.util.Locale locale) throws BrokerException
event
- the event for the dataformat_string
- the format stringlocale
- determines formatting of field valuesBrokerException
public static java.util.Vector<COM.activesw.api.client.BrokerFormatToken> preparse(java.lang.String format_string)
public static java.lang.String assemble(BrokerEvent event, java.util.Vector tokens) throws BrokerException
assemble(event,tokens,java.util.Locale.US)
Deprecated - consider using format() method insteadBrokerFieldNotFoundException
- If a field is referenced in the format string that is not in the event.BrokerInvalidTypeException
- If a field is not of a type supported by the string formatter.BrokerException
public static java.lang.String assemble(BrokerEvent event, java.util.Vector tokens, java.util.Locale locale) throws BrokerException
BrokerFieldNotFoundException
- If a field is referenced in the format string that is not in the event.BrokerInvalidTypeException
- If a field is not of a type supported by the string formatter.BrokerException
public static java.lang.String assemble(java.util.Vector tokens)
public java.lang.String formatBindVariable(int index, java.lang.StringBuffer place_holder_name)
Copyright © 2002-2006 webMethods, Inc. Copyright © 2007-2021 Software AG Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.