Skip to content

Commit

Permalink
Simplify enums: reuse enum name and remove unnecessary code (alibaba#…
Browse files Browse the repository at this point in the history
  • Loading branch information
quaff authored Mar 4, 2021
1 parent 3755d53 commit df871b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,16 @@
* An enum marks resource invocation direction.
*
* @author jialiang.linjl
* @author Yanming Zhou
*/
public enum EntryType {
/**
* Inbound traffic
*/
IN("IN"),
IN,
/**
* Outbound traffic
*/
OUT("OUT");
OUT;

private final String name;

EntryType(String s) {
name = s;
}

public boolean equalsName(String otherName) {
return name.equals(otherName);
}

@Override
public String toString() {
return name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

/**
* @author Leo Li
* @author Yanming Zhou
*/
public enum Protocol {
HTTP("http"),
HTTPS("https");

private String protocol;

Protocol(String protocol) {
this.protocol = protocol;
}
HTTP,
HTTPS;

public String getProtocol() {
return protocol;
return name().toLowerCase();
}
}

0 comments on commit df871b0

Please sign in to comment.