Class Scanner
- java.lang.Object
-
- com.google.javascript.refactoring.Scanner
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
GoogBindToArrow
public abstract class Scanner extends java.lang.Object implements java.io.Serializable
Class that developers should implement to perform a JsFlume refactoring.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Scanner()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
matches(Node node, NodeMetadata t)
Returns true if the given node and node traversal should match for this particular scanner.java.util.List<SuggestedFix>
processAllMatches(java.util.Collection<Match> matches)
Processes every given match at one time.java.util.List<SuggestedFix>
processMatch(Match match)
Processes oneMatch
at a time.
-
-
-
Method Detail
-
matches
public abstract boolean matches(Node node, NodeMetadata t)
Returns true if the given node and node traversal should match for this particular scanner. Typically this function uses theMatcher
class or predefined matchers fromMatchers
to match against the Node and NodeMetadata. If this function returns true, aMatch
for this node will be passed toprocessMatch(Match)
and all matches will be passed toprocessAllMatches(Collection)
at the end of the traversal.
-
processMatch
public java.util.List<SuggestedFix> processMatch(Match match)
Processes oneMatch
at a time. There is no order guaranteed for when this function will be called with the Match.- Parameters:
match
- TheMatch
from the node and traversal for any match thatmatches(com.google.javascript.rhino.Node, com.google.javascript.refactoring.NodeMetadata)
returned true for.- Returns:
- List of
SuggestedFix
classes that will be applied to the source files at the end of the run to create the refactoring CL.
-
processAllMatches
public java.util.List<SuggestedFix> processAllMatches(java.util.Collection<Match> matches)
Processes every given match at one time. This function can be used when the refactoring needs the information from the entire run to perform the refactoring, such as moving functions around.- Parameters:
matches
- All theMatch
matches that were collected when thematches(com.google.javascript.rhino.Node, com.google.javascript.refactoring.NodeMetadata)
function returned true.- Returns:
- List of
SuggestedFix
classes that will be applied to the source files at the end of the run to create the refactoring CL.
-
-