Class Scanner
- java.lang.Object
-
- com.google.javascript.refactoring.Scanner
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
GoogBindToArrow,RefasterJsScanner
public abstract class Scanner extends java.lang.Object implements java.io.SerializableClass 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 booleanmatches(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 oneMatchat 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 theMatcherclass or predefined matchers fromMatchersto match against the Node and NodeMetadata. If this function returns true, aMatchfor 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 oneMatchat a time. There is no order guaranteed for when this function will be called with the Match.- Parameters:
match- TheMatchfrom the node and traversal for any match thatmatches(com.google.javascript.rhino.Node, com.google.javascript.refactoring.NodeMetadata)returned true for.- Returns:
- List of
SuggestedFixclasses 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 theMatchmatches that were collected when thematches(com.google.javascript.rhino.Node, com.google.javascript.refactoring.NodeMetadata)function returned true.- Returns:
- List of
SuggestedFixclasses that will be applied to the source files at the end of the run to create the refactoring CL.
-
-