Package com.helger.xml.xpath
Class MapBasedXPathVariableResolverQName
- java.lang.Object
-
- com.helger.xml.xpath.MapBasedXPathVariableResolverQName
-
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<MapBasedXPathVariableResolverQName>,XPathVariableResolver
@NotThreadSafe public class MapBasedXPathVariableResolverQName extends Object implements XPathVariableResolver, com.helger.commons.lang.ICloneable<MapBasedXPathVariableResolverQName>
Class is used in conjunction withXPathExpressionto resolve variable values used in XPath queries at runtime. The whole QName is used as the key in the map. The namespace is not-ignored in this class.- Author:
- Philip Helger
- See Also:
MapBasedXPathVariableResolver
-
-
Constructor Summary
Constructors Constructor Description MapBasedXPathVariableResolverQName()Default ctor.MapBasedXPathVariableResolverQName(MapBasedXPathVariableResolverQName aOther)Copy constructorMapBasedXPathVariableResolverQName(Map<QName,?> aVars)Ctor taking another map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.helger.commons.state.EChangeaddAllFrom(MapBasedXPathVariableResolver aOther, boolean bOverwrite)Add all variables from the other variable resolver into this resolver.com.helger.commons.state.EChangeaddAllFrom(MapBasedXPathVariableResolverQName aOther, boolean bOverwrite)Add all variables from the other variable resolver into this resolver.com.helger.commons.state.EChangeaddUniqueVariable(QName aName, Object aValue)Add a new variable.com.helger.commons.state.EChangeclear()Remove all variables at once.booleanequals(Object o)com.helger.commons.collection.impl.ICommonsMap<QName,?>getAllVariables()MapBasedXPathVariableResolverQNamegetClone()intgetVariableCount()inthashCode()com.helger.commons.state.EChangeremoveVariable(QName aName)Remove the variable with the specified name.com.helger.commons.state.EChangeremoveVariables(Iterable<? extends QName> aNames)Remove multiple variables at once.ObjectresolveVariable(QName aVariableName)voidsetAllVariables(Map<QName,?> aVars)Set multiple variables at once.StringtoString()
-
-
-
Constructor Detail
-
MapBasedXPathVariableResolverQName
public MapBasedXPathVariableResolverQName()
Default ctor.
-
MapBasedXPathVariableResolverQName
public MapBasedXPathVariableResolverQName(@Nullable Map<QName,?> aVars)
Ctor taking another map.- Parameters:
aVars- Variables to re-use. May benull.
-
MapBasedXPathVariableResolverQName
public MapBasedXPathVariableResolverQName(@Nonnull MapBasedXPathVariableResolverQName aOther)
Copy constructor- Parameters:
aOther- Object to copy data from
-
-
Method Detail
-
addUniqueVariable
@Nonnull public com.helger.commons.state.EChange addUniqueVariable(@Nonnull QName aName, @Nonnull Object aValue)
Add a new variable.- Parameters:
aName- The qualified name of the variableaValue- The value to be used.- Returns:
EChange
-
addAllFrom
@Nonnull public com.helger.commons.state.EChange addAllFrom(@Nonnull MapBasedXPathVariableResolverQName aOther, boolean bOverwrite)
Add all variables from the other variable resolver into this resolver.- Parameters:
aOther- The variable resolver to import the variable from. May not benull.bOverwrite- iftrueexisting variables will be overwritten with the new variables, otherwise the old variables are kept.- Returns:
EChange
-
addAllFrom
@Nonnull public com.helger.commons.state.EChange addAllFrom(@Nonnull MapBasedXPathVariableResolver aOther, boolean bOverwrite)
Add all variables from the other variable resolver into this resolver. This methods creates a QName with an empty namespace URI.- Parameters:
aOther- The variable resolver to import the variable from. May not benull.bOverwrite- iftrueexisting variables will be overwritten with the new variables, otherwise the old variables are kept.- Returns:
EChange
-
removeVariable
@Nonnull public com.helger.commons.state.EChange removeVariable(@Nullable QName aName)
Remove the variable with the specified name.- Parameters:
aName- The name to be removed. May benull.- Returns:
EChange
-
removeVariables
@Nonnull public com.helger.commons.state.EChange removeVariables(@Nullable Iterable<? extends QName> aNames)
Remove multiple variables at once.- Parameters:
aNames- The names to be removed. May benull.- Returns:
EChange.CHANGEDif at least one variable was removed.
-
getAllVariables
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsMap<QName,?> getAllVariables()
- Returns:
- A mutable copy of all contained variables. Never
nullbut maybe empty.
-
getVariableCount
@Nonnegative public int getVariableCount()
- Returns:
- The number of contained variables. Always ≥ 0.
-
clear
@Nonnull public com.helger.commons.state.EChange clear()
Remove all variables at once.- Returns:
EChange.CHANGEDif at least one variable was removed.
-
setAllVariables
public void setAllVariables(@Nullable Map<QName,?> aVars)
Set multiple variables at once.- Parameters:
aVars- The variables to be set. May benull.
-
resolveVariable
@Nullable public Object resolveVariable(@Nonnull QName aVariableName)
- Specified by:
resolveVariablein interfaceXPathVariableResolver
-
getClone
@Nonnull @ReturnsMutableCopy public MapBasedXPathVariableResolverQName getClone()
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<MapBasedXPathVariableResolverQName>
-
-