@NotThreadSafe public class MapBasedXPathVariableResolver extends Object implements XPathVariableResolver, ICloneable<MapBasedXPathVariableResolver>
XPathExpression to
resolve variable values used in XPath queries at runtime. The local part of
the QName to resolve is used as the key in the map. The namespace is ignored
in this class.MapBasedXPathVariableResolverQName| Constructor and Description |
|---|
MapBasedXPathVariableResolver()
Default ctor.
|
MapBasedXPathVariableResolver(Map<String,?> aVars)
Ctor taking another map.
|
MapBasedXPathVariableResolver(MapBasedXPathVariableResolver aOther)
Copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
EChange |
addAllFrom(MapBasedXPathVariableResolver aOther,
boolean bOverwrite)
Add all variables from the other variable resolver into this resolver.
|
EChange |
addAllFrom(MapBasedXPathVariableResolverQName aOther,
boolean bOverwrite)
Add all variables from the other variable resolver into this resolver.
|
EChange |
addUniqueVariable(String sName,
Object aValue)
Add a new variable.
|
EChange |
clear()
Remove all variables at once.
|
boolean |
equals(Object o) |
Map<String,?> |
getAllVariables() |
MapBasedXPathVariableResolver |
getClone() |
int |
getVariableCount() |
int |
hashCode() |
EChange |
removeVariable(String sName)
Remove the variable with the specified name.
|
EChange |
removeVariables(Iterable<String> aNames)
Remove multiple variables at once.
|
Object |
resolveVariable(QName aVariableName) |
void |
setAllVariables(Map<String,?> aVars)
Set multiple variables at once.
|
String |
toString() |
public MapBasedXPathVariableResolver()
public MapBasedXPathVariableResolver(@Nullable Map<String,?> aVars)
aVars - Variables to re-use. May be null.public MapBasedXPathVariableResolver(@Nonnull MapBasedXPathVariableResolver aOther)
aOther - Object to copy data from@Nonnull public EChange addUniqueVariable(@Nonnull String sName, @Nonnull Object aValue)
sName - The name (=local part) of the variableaValue - The value to be used.EChange@Nonnull public EChange addAllFrom(@Nonnull MapBasedXPathVariableResolver aOther, boolean bOverwrite)
aOther - The variable resolver to import the variable from. May not be
null.bOverwrite - if true existing variables will be overwritten with the
new variables, otherwise the old variables are kept.EChange@Nonnull public EChange addAllFrom(@Nonnull MapBasedXPathVariableResolverQName aOther, boolean bOverwrite)
aOther - The variable resolver to import the variable from. May not be
null.bOverwrite - if true existing variables will be overwritten with the
new variables, otherwise the old variables are kept.EChange@Nonnull public EChange removeVariable(@Nullable String sName)
sName - The name to be removed. May be null.EChange@Nonnull public EChange removeVariables(@Nullable Iterable<String> aNames)
aNames - The names to be removed. May be null.EChange.CHANGED if at least one variable was removed.@Nonnull @ReturnsMutableCopy public Map<String,?> getAllVariables()
null
but maybe empty.@Nonnegative public int getVariableCount()
@Nonnull public EChange clear()
EChange.CHANGED if at least one variable was removed.public void setAllVariables(@Nullable Map<String,?> aVars)
aVars - The variables to be set. May be null.@Nullable public Object resolveVariable(@Nonnull QName aVariableName)
resolveVariable in interface XPathVariableResolver@Nonnull @ReturnsMutableCopy public MapBasedXPathVariableResolver getClone()
getClone in interface ICloneable<MapBasedXPathVariableResolver>Copyright © 2014–2016 Philip Helger. All rights reserved.