Skip to content

Commit 51b8da2

Browse files
committed
Rename constant names to match regular expressions and comply a naming convention
1 parent c942d7c commit 51b8da2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

webmagic-extension/src/main/java/us/codecraft/webmagic/configurable/ExpressionType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
*/
66
public enum ExpressionType {
77

8-
XPath, Regex, Css, JsonPath;
8+
X_PATH, REGEX, CSS, JSON_PATH;
99

1010
}

webmagic-extension/src/main/java/us/codecraft/webmagic/configurable/ExtractRule.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@ public Selector getSelector() {
7777

7878
private Selector compileSelector() {
7979
switch (expressionType) {
80-
case Css:
80+
case CSS:
8181
if (expressionParams.length >= 1) {
8282
return $(expressionValue, expressionParams[0]);
8383
} else {
8484
return $(expressionValue);
8585
}
86-
case XPath:
86+
case X_PATH:
8787
return xpath(expressionValue);
88-
case Regex:
88+
case REGEX:
8989
if (expressionParams.length >= 1) {
9090
return regex(expressionValue, Integer.parseInt(expressionParams[0]));
9191
} else {
9292
return regex(expressionValue);
9393
}
94-
case JsonPath:
94+
case JSON_PATH:
9595
return new JsonPathSelector(expressionValue);
9696
default:
9797
return xpath(expressionValue);

0 commit comments

Comments
 (0)