The notation [x1, ..., xn/y1, ..., yn]E denotes a copy of E in which all occurrences of yi, 1 <= i <= n have been replaced with xi.Note that, contrary to the specification, this method will not create a copy of this type if no substitutions were required, but will return this type directly. @param argumentTypes the actual type arguments being substituted for the parameters @param parameterTypes the parameters to be replaced @return the result of performing the substitution
null
for a raw type.
Reads the character stream from the given {@link Substitutable} object,perform substitution and writes it back to the object.
@param substituable Provide input and output stream. @throws StringSubstitutionException If any error occurs during substitution operation. Substitutes the attributes (before they are passed to the Rule
implementations's).
Digester
will only call this method a second time once the original Attributes
instance can be safely reused. The implementation is therefore free to reuse the same Attributes
instance for all calls.
Attributes
passed into Digester
by the SAX parser, not null (butmay be empty)
@return Attributes
to be passed to the Rule
implementations. This method may pass backthe Attributes passed in. Not null but possibly empty.
Example1: for template "/{a}/{b}/{a}" {@link #getVariables()} returns "[a, b, a]"; providing here listof value "[foo, bar, baz]" results with "/foo/bar/baz".
Example2: for template "/{a}/{b}/{a}" providing list of values "[foo]" results with "/foo/{b}/{a}". @param values values for variables @return template with bound variables. @throws IllegalArgumentException when values is null, any value does not match pattern etc.
There is a special case of backslashing that you need to pay attention to. As demonstrated above, to denote a delimiter in the substituted string it must be backslashed. However, this can be a problem when you want to denote a backslash at the end of the substituted string. As of PerlTools 1.3, a new means of handling this situation has been implemented. In previous versions, the behavior was that
"... a double backslash (quadrupled in the Java String) always represents two backslashes unless the second backslash is followed by the delimiter, in which case it represents a single backslash."
The new behavior is that a backslash is always a backslash in the substitution portion of the expression unless it is used to escape a delimiter. A backslash is considered to escape a delimiter if an even number of contiguous backslashes preceed the backslash and the delimiter following the backslash is not the FINAL delimiter in the expression. Therefore, backslashes preceding final delimiters are never considered to escape the delimiter. The following, which used to be an invalid expression and require a special-case extra backslash, will now replace all instances of / with \:
numSubs = util.substitute(result, "s#/#\\#g", input);
@param result The StringBuffer in which to store the result of thesubstitutions. The buffer is only appended to. @param expression The Perl5 substitution regular expression. @param input The input on which to perform substitutions. @return The number of substitutions made. @exception MalformedPerl5PatternException If there is an error inthe expression. You are not forced to catch this exception because it is derived from RuntimeException. @since 2.0.6
Substitute all variable references in the supplied string, using a Unix Bourne Shell-style variable syntax. This method uses a supplied VariableDereferencer object to resolve variable values. Note that this method throws no exceptions. Syntax errors in the variable references are silently ignored. Variables that have no value are substituted as the empty string. If the nameChecker parameter is not null, this method calls its {@link VariableNameChecker#legalVariableCharacter(char)} method todetermine whether a given character is a legal part of a variable name. If nameChecker is null, then this method assumes that variable names may consist solely of alphanumeric characters, underscores and periods. This syntax is sufficient to substitute variables from System.properties, for instance.
@param s the string containing possible variable references @param deref the VariableDereferencer objectto use to resolve the variables' values. @param nameChecker the VariableNameChecker object to beused to check for legal variable name characters, or null @param context an optional context object, passed throughunmodified to the deref object's {@link VariableDereferencer#getVariableValue}method. This object can be anything at all (and, in fact, may be null if you don't care.) It's primarily useful for passing context information from the caller to the VariableDereferencer. @return The (possibly) expanded string. @throws UndefinedVariableException undefined variable, and{@link #getAbortOnUndefinedVariable}returns true @throws VariableSyntaxException syntax error, and{@link #getAbortOnSyntaxError}returns true @throws VariableSubstitutionException substitution error @see #substitute(String,VariableDereferencer,Object) @see VariableDereferencer#getVariableValue(String,Object) @deprecated As of version 2.3; please use {@link #setHonorEscapes}binding
map are untouched. Note that variable capture is not prevented by this operation, and care must be taken to ensure this does not arise.
@param binding --- a map from variables to the bytecodes wwhich are to replace them.
@return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|