Class AmpPathElement
- java.lang.Object
-
- com.bazaarvoice.jolt.common.pathelement.BasePathElement
-
- com.bazaarvoice.jolt.common.pathelement.AmpPathElement
-
- All Implemented Interfaces:
EvaluatablePathElement
,MatchablePathElement
,PathElement
public class AmpPathElement extends BasePathElement implements MatchablePathElement, EvaluatablePathElement
PathElement class that handles keys with & values, like input: "photos-&(1,1)"" It breaks down the string into a series of String or Reference tokens, that can be used to 1) match input like "photos-5" where "&(1,1)" evaluated to 5
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
canonicalForm
private java.util.List<java.lang.Object>
tokens
-
Constructor Summary
Constructors Constructor Description AmpPathElement(java.lang.String key)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
evaluate(WalkedPath walkedPath)
Evaluate this key as if it is an write path element.private static int
findEndOfReference(java.lang.String key)
java.lang.String
getCanonicalForm()
Get the canonical form of this PathElement.java.util.List<java.lang.Object>
getTokens()
MatchedElement
match(java.lang.String dataKey, WalkedPath walkedPath)
See if this PathElement matches the given dataKey.-
Methods inherited from class com.bazaarvoice.jolt.common.pathelement.BasePathElement
getRawKey, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.bazaarvoice.jolt.common.pathelement.PathElement
getRawKey
-
-
-
-
Method Detail
-
findEndOfReference
private static int findEndOfReference(java.lang.String key)
-
getCanonicalForm
public java.lang.String getCanonicalForm()
Description copied from interface:PathElement
Get the canonical form of this PathElement. Really only interesting for the Reference Path element, where it will expand "&" to "&0(0)".- Specified by:
getCanonicalForm
in interfacePathElement
- Returns:
- canonical String version of this PathElement
-
getTokens
public java.util.List<java.lang.Object> getTokens()
-
evaluate
public java.lang.String evaluate(WalkedPath walkedPath)
Description copied from interface:EvaluatablePathElement
Evaluate this key as if it is an write path element.- Specified by:
evaluate
in interfaceEvaluatablePathElement
- Parameters:
walkedPath
- "up the tree" list of LiteralPathElements, that may be used by this key as it is computing- Returns:
- String path element to use for write tree building
-
match
public MatchedElement match(java.lang.String dataKey, WalkedPath walkedPath)
Description copied from interface:MatchablePathElement
See if this PathElement matches the given dataKey. If it does not match, this method returns null. If this PathElement does match, it returns a LiteralPathElement with subKeys filled in.- Specified by:
match
in interfaceMatchablePathElement
- Parameters:
dataKey
- String key value from the input datawalkedPath
- "up the tree" list of LiteralPathElements, that may be used by this key as it is computing its match- Returns:
- null or a matched LiteralPathElement
-
-