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}
|
|