public final class ParameterRefTools
extends java.lang.Object
ParameterRef
parameter references in all kinds of strings, used in different places like
SystemDataConsumer-annotated
methods.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EVEN_BS
The regular expression for an even number of backslashes.
|
static int |
INPUT_PARAMETER_GRP
The index of the matcher group for input parameter name in the parameter
ref pattern.
|
static java.util.regex.Pattern |
IO_PARAMETER_REF_PATTERN
Pattern to match IO parameter references with a user-defined type parsing
the UDT-name.
|
static int |
LEADING_BACKSLASH_GRP
The index of the matcher group for the leading backslashes in the parameter
ref pattern.
|
static int |
OUTPUT_PARAMETER_GRP
The index of the matcher group for optional output parameter name in the
parameter ref pattern.
|
static java.util.regex.Pattern |
PARAMETER_REF_PATTERN
Pattern to match simple parameter references.
|
static int |
TYPE_CHAR_GRP
The index of the matcher group for the type character in the parameter
ref pattern.
|
static int |
UDT_NAME_GRP
The index of the matcher group for the optional UDT name in the parameter
ref pattern.
|
| Modifier and Type | Method and Description |
|---|---|
static IOParameterRef[] |
findIOParameterReferences(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Finds all IO parameter references in the given string and returns them.
|
static ParameterRef[] |
findParameterReferences(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Finds all simple parameter references (see
SystemDataConsumer)
in the given string and returns them. |
static ProcessConstants.AdeptDataType |
fromTypeKey(java.lang.String typeKey)
Returns the data type associated to the given type key or
null if
the type key is not recognised. |
static IOParameterRefParser |
getIOParser(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Returns a parser for the specified parameterised string (for IO parameter
references).
|
static IOParameterRefReplacer |
getIOReplacer(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Returns a replacer for the specified parameterised string (for IO parameter
references) to replace parameter references with actual values.
|
static ParameterRefParser |
getParser(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Returns a parser for the specified parameterised string (for simple
parameter references).
|
static ParameterRefReplacer |
getReplacer(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Returns a replacer for the specified parameterised string (for simple
parameter references) to replace parameter references with actual values.
|
static IOParameterRef[] |
listIOParameterReferences(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Finds all IO parameter references in the given string and returns them in
the encountered order.
|
static ParameterRef[] |
listParameterReferences(java.lang.String parameterisedString,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Lists all simple parameter references (see
SystemDataConsumer) in
the given string and returns them in the encountered order. |
static IOParameterRef |
parseIOParameterReference(java.lang.String parameterReference,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Parses the specified string representation of a IO parameter reference (
IO_PARAMETER_REF_PATTERN)
(including the enclosing '%'s) and returns it as a IOParameterRef
object (or null if the reference is in any way illegal). |
static ParameterRef |
parseParameterReference(java.lang.String parameterReference,
java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
Parses the specified string representation of a simple parameter reference (
PARAMETER_REF_PATTERN)
(including the enclosing '%'s) and returns it as a ParameterRef
object (or null if the reference is in any way illegal). |
static java.lang.String |
toTypeKey(ProcessConstants.AdeptDataType dataType)
Returns the type key (i.e. the identifying character in parameter
references) for the specified data type.
|
static java.lang.String |
unescapeIdentifier(java.lang.String s)
Unescapes the designated identifier name, that is
\ are
removed where appropriate. |
public static final java.lang.String EVEN_BS
public static final int LEADING_BACKSLASH_GRP
public static final int TYPE_CHAR_GRP
public static final int UDT_NAME_GRP
public static final int INPUT_PARAMETER_GRP
public static final int OUTPUT_PARAMETER_GRP
public static final java.util.regex.Pattern PARAMETER_REF_PATTERN
% and : have to be escaped appropriately with
\. group(2) is the type char, group(3) is the (optional) UDT
name (may be null or the empty string) and group(4) is the
input parameter name. The caller has to validate whether the UDT name is
makes sense or is required, the pattern does not check this. unescape the found
parameter and data type names. ParameterRefParser and
ParameterRefReplacer. They might be more suitable for you.public static final java.util.regex.Pattern IO_PARAMETER_REF_PATTERN
% and : with \. group(2) is the type
char, group(3) is the (optional) UDT name (may be null or the
empty string), group(4) is the input parameter name and group(5) the
optional output parameter name (may be null or the empty
string). The caller has to validate whether the UDT name is
makes sense or is required, the pattern does not check this. unescape the found
parameter and data type names. ParameterRefParser and
ParameterRefReplacer. They might be more suitable for you.public static ParameterRef[] findParameterReferences(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
SystemDataConsumer)
in the given string and returns them. This method will avoid returning
duplicates (i.e. two parameter references that exactly match in name and
type).parameterisedString - a string, potentially containing variables /
parameter referencesconsideredDataTypes - the set of data types considered by this
parser; all others will be ignored; use null to consider
all data typespublic static IOParameterRef[] findIOParameterReferences(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
parameterisedString - a string, potentially containing variables /
parameter referencesconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typespublic static ParameterRef[] listParameterReferences(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
SystemDataConsumer) in
the given string and returns them in the encountered order. This method
will NOT avoid returning duplicates.parameterisedString - a string, potentially containing variables /
parameter referencesconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typespublic static IOParameterRef[] listIOParameterReferences(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
parameterisedString - a string, potentially containing variables /
parameter referencesconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typespublic static ParameterRef parseParameterReference(java.lang.String parameterReference, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
PARAMETER_REF_PATTERN)
(including the enclosing '%'s) and returns it as a ParameterRef
object (or null if the reference is in any way illegal).parameterReference - string representation of a simple parameter referenceconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typesParameterRef object or null if the
reference is in any way illegalpublic static IOParameterRef parseIOParameterReference(java.lang.String parameterReference, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
IO_PARAMETER_REF_PATTERN)
(including the enclosing '%'s) and returns it as a IOParameterRef
object (or null if the reference is in any way illegal).parameterReference - string representation of a simple parameter
referenceconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typesIOParameterRef object or null if the
reference is in any way illegalpublic static ParameterRefParser getParser(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
findParameterReferences(String, EnumSet) is that the parser
provides position information (start and end index of parameter reference).parameterisedString - the parameterised string to be formattedconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typespublic static ParameterRefReplacer getReplacer(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
parameterisedString - the parameterised string to be processedconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typespublic static IOParameterRefParser getIOParser(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
findParameterReferences(String, EnumSet) is that the parser
provides position information (start and end index of parameter reference).parameterisedString - the parameterised string to be formattedconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typespublic static IOParameterRefReplacer getIOReplacer(java.lang.String parameterisedString, java.util.EnumSet<ProcessConstants.AdeptDataType> consideredDataTypes)
parameterisedString - the parameterised string to be processedconsideredDataTypes - the set of data types considered by this parser;
all others will be ignored; use null to consider all data
typespublic static java.lang.String toTypeKey(ProcessConstants.AdeptDataType dataType)
dataType - the data type for which to return the type keypublic static ProcessConstants.AdeptDataType fromTypeKey(java.lang.String typeKey)
null if
the type key is not recognised.typeKey - the type key for which to return the associated data typenull if
the type key is not recognisedpublic static java.lang.String unescapeIdentifier(java.lang.String s)
\ are
removed where appropriate.s - The identifier name (parameter or data type name) as retrieved
from the matching the regular expression.\.