proj_name
stringclasses 91
values | relative_path
stringclasses 558
values | class_name
stringclasses 959
values | func_name
stringlengths 1
70
| masked_class
stringlengths 69
162k
| func_body
stringlengths 0
30.5k
|
---|---|---|---|---|---|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getId | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {<FILL_FUNCTION_BODY>}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return id;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setId | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {<FILL_FUNCTION_BODY>}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.id = id;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getUri | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {<FILL_FUNCTION_BODY>}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return uri;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setUri | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {<FILL_FUNCTION_BODY>}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.uri = uri;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getPredicates | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {<FILL_FUNCTION_BODY>}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return predicates;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setPredicates | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {<FILL_FUNCTION_BODY>}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.predicates = predicates;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getUserPredicates | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {<FILL_FUNCTION_BODY>}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return userPredicates;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setUserPredicates | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {<FILL_FUNCTION_BODY>}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.userPredicates = userPredicates;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getFilters | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {<FILL_FUNCTION_BODY>}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return filters;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setFilters | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {<FILL_FUNCTION_BODY>}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.filters = filters;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getUserFilters | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {<FILL_FUNCTION_BODY>}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return userFilters;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setUserFilters | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {<FILL_FUNCTION_BODY>}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.userFilters = userFilters;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getOrder | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {<FILL_FUNCTION_BODY>}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return order;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setOrder | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {<FILL_FUNCTION_BODY>}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.order = order;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | getMetadata | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {<FILL_FUNCTION_BODY>}
public void setMetadata(Map<String, Object> metadata) {
if (metadata != null) {
this.metadata = metadata;
}
}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return metadata;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | GatewayStrategyRouteEntity | setMetadata | class GatewayStrategyRouteEntity implements Serializable {
private static final long serialVersionUID = 8552414941889295450L;
private String id;
private String uri;
private List<String> predicates = new ArrayList<String>();
private List<Predicate> userPredicates = new ArrayList<Predicate>();
private List<String> filters = new ArrayList<String>();
private List<Filter> userFilters = new ArrayList<Filter>();
private int order = 0;
private Map<String, Object> metadata = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public List<String> getPredicates() {
return predicates;
}
public void setPredicates(List<String> predicates) {
this.predicates = predicates;
}
public List<Predicate> getUserPredicates() {
return userPredicates;
}
public void setUserPredicates(List<Predicate> userPredicates) {
this.userPredicates = userPredicates;
}
public List<String> getFilters() {
return filters;
}
public void setFilters(List<String> filters) {
this.filters = filters;
}
public List<Filter> getUserFilters() {
return userFilters;
}
public void setUserFilters(List<Filter> userFilters) {
this.userFilters = userFilters;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {<FILL_FUNCTION_BODY>}
public static class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
if (metadata != null) {
this.metadata = metadata;
}
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Predicate | hashCode | class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {<FILL_FUNCTION_BODY>}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return HashCodeBuilder.reflectionHashCode(this);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Predicate | equals | class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {<FILL_FUNCTION_BODY>}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return EqualsBuilder.reflectionEquals(this, object);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Predicate | toString | class Predicate extends Clause {
private static final long serialVersionUID = -5113611207453059195L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
} |
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Filter | hashCode | class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {<FILL_FUNCTION_BODY>}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return HashCodeBuilder.reflectionHashCode(this);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Filter | equals | class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {<FILL_FUNCTION_BODY>}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return EqualsBuilder.reflectionEquals(this, object);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Filter | toString | class Filter extends Clause {
private static final long serialVersionUID = 4975847305584873755L;
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
} |
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | getName | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {<FILL_FUNCTION_BODY>}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return name;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | setName | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {<FILL_FUNCTION_BODY>}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.name = name;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | getArgs | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {<FILL_FUNCTION_BODY>}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return args;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | setArgs | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {<FILL_FUNCTION_BODY>}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.args = args;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | addArg | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {<FILL_FUNCTION_BODY>}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
this.args.put(key, value);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | hashCode | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {<FILL_FUNCTION_BODY>}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return HashCodeBuilder.reflectionHashCode(this);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | equals | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {<FILL_FUNCTION_BODY>}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} |
return EqualsBuilder.reflectionEquals(this, object);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | toString | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
} |
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | toClausesJson | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {<FILL_FUNCTION_BODY> |
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | hashCode | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {<FILL_FUNCTION_BODY> |
return HashCodeBuilder.reflectionHashCode(this);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | equals | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {<FILL_FUNCTION_BODY> |
return EqualsBuilder.reflectionEquals(this, object);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/entity/GatewayStrategyRouteEntity.java | Clause | toString | class Clause implements Serializable {
private static final long serialVersionUID = -6284675851623689077L;
private String name;
private Map<String, String> args = new LinkedHashMap<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getArgs() {
return args;
}
public void setArgs(Map<String, String> args) {
this.args = args;
}
public void addArg(String key, String value) {
this.args.put(key, value);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static <T extends Clause> String toClausesJson(List<T> clauses) {
StringBuilder stringBuilder = new StringBuilder();
for (Clause clause : clauses) {
stringBuilder.append(String.format("%s=%s, ", clause.getName(), JsonUtil.toJson(clause.getArgs())));
}
if (stringBuilder.length() > 0) {
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object object) {
return EqualsBuilder.reflectionEquals(this, object);
}
@Override
public String toString() {<FILL_FUNCTION_BODY> |
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | serialize | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {<FILL_FUNCTION_BODY>}
} |
gen.writeFieldName(StringUtils.EMPTY);
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | toJson | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(StringUtils.EMPTY);
}
}
public static <T> String toJson(T object) {<FILL_FUNCTION_BODY> |
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | toPrettyJson | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(StringUtils.EMPTY);
}
}
public static <T> String toJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> String toPrettyJson(T object) {<FILL_FUNCTION_BODY> |
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writer(discoveryPrettyPrinter).writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | fromJson | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(StringUtils.EMPTY);
}
}
public static <T> String toJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> String toPrettyJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writer(discoveryPrettyPrinter).writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, Class<T> clazz) {<FILL_FUNCTION_BODY> |
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | fromJson | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(StringUtils.EMPTY);
}
}
public static <T> String toJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> String toPrettyJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writer(discoveryPrettyPrinter).writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, Class<T> clazz) {
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, TypeReference<T> typeReference) {<FILL_FUNCTION_BODY> |
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, typeReference);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | isJsonFormat | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(StringUtils.EMPTY);
}
}
public static <T> String toJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> String toPrettyJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writer(discoveryPrettyPrinter).writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, Class<T> clazz) {
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, TypeReference<T> typeReference) {
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, typeReference);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static boolean isJsonFormat(String json) {<FILL_FUNCTION_BODY> |
if (StringUtils.isBlank(json)) {
return false;
}
try {
objectMapper.readTree(json);
return true;
} catch (Exception e) {
return false;
}
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | fromJsonMap | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(StringUtils.EMPTY);
}
}
public static <T> String toJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> String toPrettyJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writer(discoveryPrettyPrinter).writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, Class<T> clazz) {
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, TypeReference<T> typeReference) {
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, typeReference);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static boolean isJsonFormat(String json) {
if (StringUtils.isBlank(json)) {
return false;
}
try {
objectMapper.readTree(json);
return true;
} catch (Exception e) {
return false;
}
}
@SuppressWarnings("unchecked")
public static String fromJsonMap(String json, String key) {<FILL_FUNCTION_BODY> |
if (StringUtils.isEmpty(json)) {
return null;
}
String value = null;
try {
Map<String, String> map = fromJson(json, Map.class);
value = map.get(key);
} catch (Exception e) {
value = json;
}
return value;
|
Nepxion_Discovery | Discovery/discovery-commons/discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java | NullKeySerializer | getObjectMapper | class NullKeySerializer extends StdSerializer<Object> {
private static final long serialVersionUID = -9176767187240330396L;
public NullKeySerializer() {
this(null);
}
public NullKeySerializer(Class<Object> object) {
super(object);
}
@Override
public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeFieldName(StringUtils.EMPTY);
}
}
public static <T> String toJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> String toPrettyJson(T object) {
if (object == null) {
throw new IllegalArgumentException("Object is null");
}
try {
return objectMapper.writer(discoveryPrettyPrinter).writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, Class<T> clazz) {
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static <T> T fromJson(String json, TypeReference<T> typeReference) {
if (StringUtils.isEmpty(json)) {
throw new IllegalArgumentException("Json is null or empty");
}
try {
return objectMapper.readValue(json, typeReference);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
public static boolean isJsonFormat(String json) {
if (StringUtils.isBlank(json)) {
return false;
}
try {
objectMapper.readTree(json);
return true;
} catch (Exception e) {
return false;
}
}
@SuppressWarnings("unchecked")
public static String fromJsonMap(String json, String key) {
if (StringUtils.isEmpty(json)) {
return null;
}
String value = null;
try {
Map<String, String> map = fromJson(json, Map.class);
value = map.get(key);
} catch (Exception e) {
value = json;
}
return value;
}
public static ObjectMapper getObjectMapper() {<FILL_FUNCTION_BODY> |
return objectMapper;
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/HistogramLogScanner.java | LazyHistogramReader | allowGet | class LazyHistogramReader implements EncodableHistogramSupplier {
private final Scanner scanner;
private boolean gotIt = true;
private LazyHistogramReader(Scanner scanner)
{
this.scanner = scanner;
}
private void allowGet()
{<FILL_FUNCTION_BODY>}
@Override
public EncodableHistogram read() throws DataFormatException
{
// prevent double calls to this method
if (gotIt) {
throw new IllegalStateException();
}
gotIt = true;
final String compressedPayloadString = scanner.next();
final ByteBuffer buffer = ByteBuffer.wrap(Base64Helper.parseBase64Binary(compressedPayloadString));
EncodableHistogram histogram = EncodableHistogram.decodeFromCompressedByteBuffer(buffer, 0);
return histogram;
}
} |
gotIt = false;
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/HistogramLogScanner.java | LazyHistogramReader | read | class LazyHistogramReader implements EncodableHistogramSupplier {
private final Scanner scanner;
private boolean gotIt = true;
private LazyHistogramReader(Scanner scanner)
{
this.scanner = scanner;
}
private void allowGet()
{
gotIt = false;
}
@Override
public EncodableHistogram read() throws DataFormatException
{<FILL_FUNCTION_BODY>}
} |
// prevent double calls to this method
if (gotIt) {
throw new IllegalStateException();
}
gotIt = true;
final String compressedPayloadString = scanner.next();
final ByteBuffer buffer = ByteBuffer.wrap(Base64Helper.parseBase64Binary(compressedPayloadString));
EncodableHistogram histogram = EncodableHistogram.decodeFromCompressedByteBuffer(buffer, 0);
return histogram;
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/HistogramLogScanner.java | LazyHistogramReader | initScanner | class LazyHistogramReader implements EncodableHistogramSupplier {
private final Scanner scanner;
private boolean gotIt = true;
private LazyHistogramReader(Scanner scanner)
{
this.scanner = scanner;
}
private void allowGet()
{
gotIt = false;
}
@Override
public EncodableHistogram read() throws DataFormatException
{
// prevent double calls to this method
if (gotIt) {
throw new IllegalStateException();
}
gotIt = true;
final String compressedPayloadString = scanner.next();
final ByteBuffer buffer = ByteBuffer.wrap(Base64Helper.parseBase64Binary(compressedPayloadString));
EncodableHistogram histogram = EncodableHistogram.decodeFromCompressedByteBuffer(buffer, 0);
return histogram;
}
}
private final LazyHistogramReader lazyReader;
protected final Scanner scanner;
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file name.
* @param inputFileName The name of the file to read from
* @throws java.io.FileNotFoundException when unable to find inputFileName
*/
public HistogramLogScanner(final String inputFileName) throws FileNotFoundException {
this(new Scanner(new File(inputFileName)));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified InputStream. Note that
* log readers constructed through this constructor do not assume ownership of stream and will not close it on
* {@link #close()}.
*
* @param inputStream The InputStream to read from
*/
public HistogramLogScanner(final InputStream inputStream) {
this(new Scanner(inputStream));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file.
* @param inputFile The File to read from
* @throws java.io.FileNotFoundException when unable to find inputFile
*/
public HistogramLogScanner(final File inputFile) throws FileNotFoundException {
this(new Scanner(inputFile));
}
private HistogramLogScanner(Scanner scanner)
{
this.scanner = scanner;
this.lazyReader = new LazyHistogramReader(scanner);
initScanner();
}
private void initScanner() {<FILL_FUNCTION_BODY> |
scanner.useLocale(Locale.US);
scanner.useDelimiter("[ ,\\r\\n]");
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/HistogramLogScanner.java | LazyHistogramReader | close | class LazyHistogramReader implements EncodableHistogramSupplier {
private final Scanner scanner;
private boolean gotIt = true;
private LazyHistogramReader(Scanner scanner)
{
this.scanner = scanner;
}
private void allowGet()
{
gotIt = false;
}
@Override
public EncodableHistogram read() throws DataFormatException
{
// prevent double calls to this method
if (gotIt) {
throw new IllegalStateException();
}
gotIt = true;
final String compressedPayloadString = scanner.next();
final ByteBuffer buffer = ByteBuffer.wrap(Base64Helper.parseBase64Binary(compressedPayloadString));
EncodableHistogram histogram = EncodableHistogram.decodeFromCompressedByteBuffer(buffer, 0);
return histogram;
}
}
private final LazyHistogramReader lazyReader;
protected final Scanner scanner;
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file name.
* @param inputFileName The name of the file to read from
* @throws java.io.FileNotFoundException when unable to find inputFileName
*/
public HistogramLogScanner(final String inputFileName) throws FileNotFoundException {
this(new Scanner(new File(inputFileName)));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified InputStream. Note that
* log readers constructed through this constructor do not assume ownership of stream and will not close it on
* {@link #close()}.
*
* @param inputStream The InputStream to read from
*/
public HistogramLogScanner(final InputStream inputStream) {
this(new Scanner(inputStream));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file.
* @param inputFile The File to read from
* @throws java.io.FileNotFoundException when unable to find inputFile
*/
public HistogramLogScanner(final File inputFile) throws FileNotFoundException {
this(new Scanner(inputFile));
}
private HistogramLogScanner(Scanner scanner)
{
this.scanner = scanner;
this.lazyReader = new LazyHistogramReader(scanner);
initScanner();
}
private void initScanner() {
scanner.useLocale(Locale.US);
scanner.useDelimiter("[ ,\\r\\n]");
}
/**
* Close underlying scanner.
*/
@Override
public void close()
{<FILL_FUNCTION_BODY> |
scanner.close();
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/HistogramLogScanner.java | LazyHistogramReader | process | class LazyHistogramReader implements EncodableHistogramSupplier {
private final Scanner scanner;
private boolean gotIt = true;
private LazyHistogramReader(Scanner scanner)
{
this.scanner = scanner;
}
private void allowGet()
{
gotIt = false;
}
@Override
public EncodableHistogram read() throws DataFormatException
{
// prevent double calls to this method
if (gotIt) {
throw new IllegalStateException();
}
gotIt = true;
final String compressedPayloadString = scanner.next();
final ByteBuffer buffer = ByteBuffer.wrap(Base64Helper.parseBase64Binary(compressedPayloadString));
EncodableHistogram histogram = EncodableHistogram.decodeFromCompressedByteBuffer(buffer, 0);
return histogram;
}
}
private final LazyHistogramReader lazyReader;
protected final Scanner scanner;
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file name.
* @param inputFileName The name of the file to read from
* @throws java.io.FileNotFoundException when unable to find inputFileName
*/
public HistogramLogScanner(final String inputFileName) throws FileNotFoundException {
this(new Scanner(new File(inputFileName)));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified InputStream. Note that
* log readers constructed through this constructor do not assume ownership of stream and will not close it on
* {@link #close()}.
*
* @param inputStream The InputStream to read from
*/
public HistogramLogScanner(final InputStream inputStream) {
this(new Scanner(inputStream));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file.
* @param inputFile The File to read from
* @throws java.io.FileNotFoundException when unable to find inputFile
*/
public HistogramLogScanner(final File inputFile) throws FileNotFoundException {
this(new Scanner(inputFile));
}
private HistogramLogScanner(Scanner scanner)
{
this.scanner = scanner;
this.lazyReader = new LazyHistogramReader(scanner);
initScanner();
}
private void initScanner() {
scanner.useLocale(Locale.US);
scanner.useDelimiter("[ ,\\r\\n]");
}
/**
* Close underlying scanner.
*/
@Override
public void close()
{
scanner.close();
}
public void process(EventHandler handler) {<FILL_FUNCTION_BODY> |
while (scanner.hasNextLine()) {
try {
if (scanner.hasNext("\\#.*")) {
// comment line.
// Look for explicit start time or base time notes in comments:
if (scanner.hasNext("#\\[StartTime:")) {
scanner.next("#\\[StartTime:");
if (scanner.hasNextDouble()) {
double startTimeSec = scanner.nextDouble(); // start time represented as seconds since epoch
if (handler.onStartTime(startTimeSec)) {
return;
}
}
} else if (scanner.hasNext("#\\[BaseTime:")) {
scanner.next("#\\[BaseTime:");
if (scanner.hasNextDouble()) {
double baseTimeSec = scanner.nextDouble(); // base time represented as seconds since epoch
if (handler.onBaseTime(baseTimeSec))
{
return;
}
}
} else if (handler.onComment(scanner.next("\\#.*"))) {
return;
}
continue;
}
if (scanner.hasNext("\"StartTimestamp\".*")) {
// Legend line
continue;
}
String tagString = null;
if (scanner.hasNext("Tag\\=.*")) {
tagString = scanner.next("Tag\\=.*").substring(4);
}
// Decode: startTimestamp, intervalLength, maxTime, histogramPayload
final double logTimeStampInSec = scanner.nextDouble(); // Timestamp is expected to be in seconds
final double intervalLengthSec = scanner.nextDouble(); // Timestamp length is expect to be in seconds
scanner.nextDouble(); // Skip maxTime field, as max time can be deduced from the histogram.
lazyReader.allowGet();
if (handler.onHistogram(tagString, logTimeStampInSec, intervalLengthSec, lazyReader)) {
return;
}
} catch (Throwable ex) {
if (handler.onException(ex)) {
return;
}
} finally {
scanner.nextLine(); // Move to next line.
}
}
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/HistogramLogScanner.java | LazyHistogramReader | hasNextLine | class LazyHistogramReader implements EncodableHistogramSupplier {
private final Scanner scanner;
private boolean gotIt = true;
private LazyHistogramReader(Scanner scanner)
{
this.scanner = scanner;
}
private void allowGet()
{
gotIt = false;
}
@Override
public EncodableHistogram read() throws DataFormatException
{
// prevent double calls to this method
if (gotIt) {
throw new IllegalStateException();
}
gotIt = true;
final String compressedPayloadString = scanner.next();
final ByteBuffer buffer = ByteBuffer.wrap(Base64Helper.parseBase64Binary(compressedPayloadString));
EncodableHistogram histogram = EncodableHistogram.decodeFromCompressedByteBuffer(buffer, 0);
return histogram;
}
}
private final LazyHistogramReader lazyReader;
protected final Scanner scanner;
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file name.
* @param inputFileName The name of the file to read from
* @throws java.io.FileNotFoundException when unable to find inputFileName
*/
public HistogramLogScanner(final String inputFileName) throws FileNotFoundException {
this(new Scanner(new File(inputFileName)));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified InputStream. Note that
* log readers constructed through this constructor do not assume ownership of stream and will not close it on
* {@link #close()}.
*
* @param inputStream The InputStream to read from
*/
public HistogramLogScanner(final InputStream inputStream) {
this(new Scanner(inputStream));
}
/**
* Constructs a new HistogramLogReader that produces intervals read from the specified file.
* @param inputFile The File to read from
* @throws java.io.FileNotFoundException when unable to find inputFile
*/
public HistogramLogScanner(final File inputFile) throws FileNotFoundException {
this(new Scanner(inputFile));
}
private HistogramLogScanner(Scanner scanner)
{
this.scanner = scanner;
this.lazyReader = new LazyHistogramReader(scanner);
initScanner();
}
private void initScanner() {
scanner.useLocale(Locale.US);
scanner.useDelimiter("[ ,\\r\\n]");
}
/**
* Close underlying scanner.
*/
@Override
public void close()
{
scanner.close();
}
public void process(EventHandler handler) {
while (scanner.hasNextLine()) {
try {
if (scanner.hasNext("\\#.*")) {
// comment line.
// Look for explicit start time or base time notes in comments:
if (scanner.hasNext("#\\[StartTime:")) {
scanner.next("#\\[StartTime:");
if (scanner.hasNextDouble()) {
double startTimeSec = scanner.nextDouble(); // start time represented as seconds since epoch
if (handler.onStartTime(startTimeSec)) {
return;
}
}
} else if (scanner.hasNext("#\\[BaseTime:")) {
scanner.next("#\\[BaseTime:");
if (scanner.hasNextDouble()) {
double baseTimeSec = scanner.nextDouble(); // base time represented as seconds since epoch
if (handler.onBaseTime(baseTimeSec))
{
return;
}
}
} else if (handler.onComment(scanner.next("\\#.*"))) {
return;
}
continue;
}
if (scanner.hasNext("\"StartTimestamp\".*")) {
// Legend line
continue;
}
String tagString = null;
if (scanner.hasNext("Tag\\=.*")) {
tagString = scanner.next("Tag\\=.*").substring(4);
}
// Decode: startTimestamp, intervalLength, maxTime, histogramPayload
final double logTimeStampInSec = scanner.nextDouble(); // Timestamp is expected to be in seconds
final double intervalLengthSec = scanner.nextDouble(); // Timestamp length is expect to be in seconds
scanner.nextDouble(); // Skip maxTime field, as max time can be deduced from the histogram.
lazyReader.allowGet();
if (handler.onHistogram(tagString, logTimeStampInSec, intervalLengthSec, lazyReader)) {
return;
}
} catch (Throwable ex) {
if (handler.onException(ex)) {
return;
}
} finally {
scanner.nextLine(); // Move to next line.
}
}
}
/**
* Indicates whether or not additional intervals may exist in the log
*
* @return true if additional intervals may exist in the log
*/
public boolean hasNextLine() {<FILL_FUNCTION_BODY> |
return scanner.hasNextLine();
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/SingleWriterDoubleRecorder.java | SingleWriterDoubleRecorder | recordValue | class SingleWriterDoubleRecorder implements DoubleValueRecorder, IntervalHistogramProvider<DoubleHistogram> {
private static AtomicLong instanceIdSequencer = new AtomicLong(1);
private final long instanceId = instanceIdSequencer.getAndIncrement();
private final WriterReaderPhaser recordingPhaser = new WriterReaderPhaser();
private volatile DoubleHistogram activeHistogram;
private DoubleHistogram inactiveHistogram;
/**
* Construct an auto-resizing {@link SingleWriterDoubleRecorder} using a precision stated as a
* number of significant decimal digits.
* <p>
* Depending on the valuer of the <b><code>packed</code></b> parameter {@link SingleWriterDoubleRecorder} can
* be configured to track value counts in a packed internal representation optimized for typical histogram
* recoded values are sparse in the value range and tend to be incremented in small unit counts. This packed
* representation tends to require significantly smaller amounts of storage when compared to unpacked
* representations, but can incur additional recording cost due to resizing and repacking operations that may
* occur as previously unrecorded values are encountered.
*
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
* @param packed Specifies whether the recorder will uses a packed internal representation or not.
*/
public SingleWriterDoubleRecorder(final int numberOfSignificantValueDigits, final boolean packed) {
activeHistogram = packed ?
new PackedInternalDoubleHistogram(instanceId, numberOfSignificantValueDigits) :
new InternalDoubleHistogram(instanceId, numberOfSignificantValueDigits);
inactiveHistogram = null;
activeHistogram.setStartTimeStamp(System.currentTimeMillis());
}
/**
* Construct an auto-resizing {@link SingleWriterDoubleRecorder} using a precision stated as a
* number of significant decimal digits.
*
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
*/
public SingleWriterDoubleRecorder(final int numberOfSignificantValueDigits) {
this(numberOfSignificantValueDigits, false);
}
/**
* Construct a {@link SingleWriterDoubleRecorder} dynamic range of values to cover and a number
* of significant decimal digits.
*
* @param highestToLowestValueRatio specifies the dynamic range to use (as a ratio)
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
*/
public SingleWriterDoubleRecorder(final long highestToLowestValueRatio,
final int numberOfSignificantValueDigits) {
activeHistogram = new InternalDoubleHistogram(
instanceId, highestToLowestValueRatio, numberOfSignificantValueDigits);
inactiveHistogram = null;
activeHistogram.setStartTimeStamp(System.currentTimeMillis());
}
/**
* Record a value
* @param value the value to record
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValue(final double value) {<FILL_FUNCTION_BODY>}
/**
* Record a value in the histogram (adding to the value's current count)
*
* @param value The value to be recorded
* @param count The number of occurrences of this value to record
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValueWithCount(final double value, final long count) throws ArrayIndexOutOfBoundsException {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithCount(value, count);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
}
/**
* Record a value
* <p>
* To compensate for the loss of sampled values when a recorded value is larger than the expected
* interval between value samples, Histogram will auto-generate an additional series of decreasingly-smaller
* (down to the expectedIntervalBetweenValueSamples) value records.
* <p>
* See related notes {@link org.HdrHistogram.DoubleHistogram#recordValueWithExpectedInterval(double, double)}
* for more explanations about coordinated omission and expected interval correction.
* *
* @param value The value to record
* @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add
* auto-generated value records as appropriate if value is larger
* than expectedIntervalBetweenValueSamples
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValueWithExpectedInterval(final double value, final double expectedIntervalBetweenValueSamples)
throws ArrayIndexOutOfBoundsException {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithExpectedInterval(value, expectedIntervalBetweenValueSamples);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
}
@Override
public synchronized DoubleHistogram getIntervalHistogram() {
return getIntervalHistogram(null);
}
@Override
public synchronized DoubleHistogram getIntervalHistogram(DoubleHistogram histogramToRecycle) {
return getIntervalHistogram(histogramToRecycle, true);
}
@Override
public synchronized DoubleHistogram getIntervalHistogram(DoubleHistogram histogramToRecycle,
boolean enforceContainingInstance) {
// Verify that replacement histogram can validly be used as an inactive histogram replacement:
validateFitAsReplacementHistogram(histogramToRecycle, enforceContainingInstance);
inactiveHistogram = histogramToRecycle;
performIntervalSample();
DoubleHistogram sampledHistogram = inactiveHistogram;
inactiveHistogram = null; // Once we expose the sample, we can't reuse it internally until it is recycled
return sampledHistogram;
}
@Override
public synchronized void getIntervalHistogramInto(DoubleHistogram targetHistogram) {
performIntervalSample();
inactiveHistogram.copyInto(targetHistogram);
}
/**
* Reset any value counts accumulated thus far.
*/
public synchronized void reset() {
// the currently inactive histogram is reset each time we flip. So flipping twice resets both:
performIntervalSample();
performIntervalSample();
}
private void performIntervalSample() {
try {
recordingPhaser.readerLock();
// Make sure we have an inactive version to flip in:
if (inactiveHistogram == null) {
if (activeHistogram instanceof InternalDoubleHistogram) {
inactiveHistogram = new InternalDoubleHistogram((InternalDoubleHistogram) activeHistogram);
} else if (activeHistogram instanceof PackedInternalDoubleHistogram) {
inactiveHistogram = new PackedInternalDoubleHistogram(
instanceId, activeHistogram.getNumberOfSignificantValueDigits());
} else {
throw new IllegalStateException("Unexpected internal histogram type for activeHistogram");
}
}
inactiveHistogram.reset();
// Swap active and inactive histograms:
final DoubleHistogram tempHistogram = inactiveHistogram;
inactiveHistogram = activeHistogram;
activeHistogram = tempHistogram;
// Mark end time of previous interval and start time of new one:
long now = System.currentTimeMillis();
activeHistogram.setStartTimeStamp(now);
inactiveHistogram.setEndTimeStamp(now);
// Make sure we are not in the middle of recording a value on the previously active histogram:
// Flip phase to make sure no recordings that were in flight pre-flip are still active:
recordingPhaser.flipPhase(500000L /* yield in 0.5 msec units if needed */);
} finally {
recordingPhaser.readerUnlock();
}
}
private class InternalDoubleHistogram extends DoubleHistogram {
private final long containingInstanceId;
private InternalDoubleHistogram(long id, int numberOfSignificantValueDigits) {
super(numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
private InternalDoubleHistogram(long id,
long highestToLowestValueRatio,
int numberOfSignificantValueDigits) {
super(highestToLowestValueRatio, numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
private InternalDoubleHistogram(InternalDoubleHistogram source) {
super(source);
this.containingInstanceId = source.containingInstanceId;
}
}
private class PackedInternalDoubleHistogram extends PackedDoubleHistogram {
private final long containingInstanceId;
private PackedInternalDoubleHistogram(long id, int numberOfSignificantValueDigits) {
super(numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
}
private void validateFitAsReplacementHistogram(DoubleHistogram replacementHistogram,
boolean enforceContainingInstance) {
boolean bad = true;
if (replacementHistogram == null) {
bad = false;
} else if ((replacementHistogram instanceof InternalDoubleHistogram)
&&
((!enforceContainingInstance) ||
(((InternalDoubleHistogram) replacementHistogram).containingInstanceId ==
((InternalDoubleHistogram)activeHistogram).containingInstanceId)
)) {
bad = false;
} else if ((replacementHistogram instanceof PackedInternalDoubleHistogram)
&&
((!enforceContainingInstance) ||
(((PackedInternalDoubleHistogram) replacementHistogram).containingInstanceId ==
((PackedInternalDoubleHistogram)activeHistogram).containingInstanceId)
)) {
bad = false;
}
if (bad) {
throw new IllegalArgumentException("replacement histogram must have been obtained via a previous " +
"getIntervalHistogram() call from this " + this.getClass().getName() +" instance");
}
}
} |
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValue(value);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/SingleWriterDoubleRecorder.java | SingleWriterDoubleRecorder | recordValueWithCount | class SingleWriterDoubleRecorder implements DoubleValueRecorder, IntervalHistogramProvider<DoubleHistogram> {
private static AtomicLong instanceIdSequencer = new AtomicLong(1);
private final long instanceId = instanceIdSequencer.getAndIncrement();
private final WriterReaderPhaser recordingPhaser = new WriterReaderPhaser();
private volatile DoubleHistogram activeHistogram;
private DoubleHistogram inactiveHistogram;
/**
* Construct an auto-resizing {@link SingleWriterDoubleRecorder} using a precision stated as a
* number of significant decimal digits.
* <p>
* Depending on the valuer of the <b><code>packed</code></b> parameter {@link SingleWriterDoubleRecorder} can
* be configured to track value counts in a packed internal representation optimized for typical histogram
* recoded values are sparse in the value range and tend to be incremented in small unit counts. This packed
* representation tends to require significantly smaller amounts of storage when compared to unpacked
* representations, but can incur additional recording cost due to resizing and repacking operations that may
* occur as previously unrecorded values are encountered.
*
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
* @param packed Specifies whether the recorder will uses a packed internal representation or not.
*/
public SingleWriterDoubleRecorder(final int numberOfSignificantValueDigits, final boolean packed) {
activeHistogram = packed ?
new PackedInternalDoubleHistogram(instanceId, numberOfSignificantValueDigits) :
new InternalDoubleHistogram(instanceId, numberOfSignificantValueDigits);
inactiveHistogram = null;
activeHistogram.setStartTimeStamp(System.currentTimeMillis());
}
/**
* Construct an auto-resizing {@link SingleWriterDoubleRecorder} using a precision stated as a
* number of significant decimal digits.
*
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
*/
public SingleWriterDoubleRecorder(final int numberOfSignificantValueDigits) {
this(numberOfSignificantValueDigits, false);
}
/**
* Construct a {@link SingleWriterDoubleRecorder} dynamic range of values to cover and a number
* of significant decimal digits.
*
* @param highestToLowestValueRatio specifies the dynamic range to use (as a ratio)
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
*/
public SingleWriterDoubleRecorder(final long highestToLowestValueRatio,
final int numberOfSignificantValueDigits) {
activeHistogram = new InternalDoubleHistogram(
instanceId, highestToLowestValueRatio, numberOfSignificantValueDigits);
inactiveHistogram = null;
activeHistogram.setStartTimeStamp(System.currentTimeMillis());
}
/**
* Record a value
* @param value the value to record
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValue(final double value) {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValue(value);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
}
/**
* Record a value in the histogram (adding to the value's current count)
*
* @param value The value to be recorded
* @param count The number of occurrences of this value to record
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValueWithCount(final double value, final long count) throws ArrayIndexOutOfBoundsException {<FILL_FUNCTION_BODY>}
/**
* Record a value
* <p>
* To compensate for the loss of sampled values when a recorded value is larger than the expected
* interval between value samples, Histogram will auto-generate an additional series of decreasingly-smaller
* (down to the expectedIntervalBetweenValueSamples) value records.
* <p>
* See related notes {@link org.HdrHistogram.DoubleHistogram#recordValueWithExpectedInterval(double, double)}
* for more explanations about coordinated omission and expected interval correction.
* *
* @param value The value to record
* @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add
* auto-generated value records as appropriate if value is larger
* than expectedIntervalBetweenValueSamples
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValueWithExpectedInterval(final double value, final double expectedIntervalBetweenValueSamples)
throws ArrayIndexOutOfBoundsException {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithExpectedInterval(value, expectedIntervalBetweenValueSamples);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
}
@Override
public synchronized DoubleHistogram getIntervalHistogram() {
return getIntervalHistogram(null);
}
@Override
public synchronized DoubleHistogram getIntervalHistogram(DoubleHistogram histogramToRecycle) {
return getIntervalHistogram(histogramToRecycle, true);
}
@Override
public synchronized DoubleHistogram getIntervalHistogram(DoubleHistogram histogramToRecycle,
boolean enforceContainingInstance) {
// Verify that replacement histogram can validly be used as an inactive histogram replacement:
validateFitAsReplacementHistogram(histogramToRecycle, enforceContainingInstance);
inactiveHistogram = histogramToRecycle;
performIntervalSample();
DoubleHistogram sampledHistogram = inactiveHistogram;
inactiveHistogram = null; // Once we expose the sample, we can't reuse it internally until it is recycled
return sampledHistogram;
}
@Override
public synchronized void getIntervalHistogramInto(DoubleHistogram targetHistogram) {
performIntervalSample();
inactiveHistogram.copyInto(targetHistogram);
}
/**
* Reset any value counts accumulated thus far.
*/
public synchronized void reset() {
// the currently inactive histogram is reset each time we flip. So flipping twice resets both:
performIntervalSample();
performIntervalSample();
}
private void performIntervalSample() {
try {
recordingPhaser.readerLock();
// Make sure we have an inactive version to flip in:
if (inactiveHistogram == null) {
if (activeHistogram instanceof InternalDoubleHistogram) {
inactiveHistogram = new InternalDoubleHistogram((InternalDoubleHistogram) activeHistogram);
} else if (activeHistogram instanceof PackedInternalDoubleHistogram) {
inactiveHistogram = new PackedInternalDoubleHistogram(
instanceId, activeHistogram.getNumberOfSignificantValueDigits());
} else {
throw new IllegalStateException("Unexpected internal histogram type for activeHistogram");
}
}
inactiveHistogram.reset();
// Swap active and inactive histograms:
final DoubleHistogram tempHistogram = inactiveHistogram;
inactiveHistogram = activeHistogram;
activeHistogram = tempHistogram;
// Mark end time of previous interval and start time of new one:
long now = System.currentTimeMillis();
activeHistogram.setStartTimeStamp(now);
inactiveHistogram.setEndTimeStamp(now);
// Make sure we are not in the middle of recording a value on the previously active histogram:
// Flip phase to make sure no recordings that were in flight pre-flip are still active:
recordingPhaser.flipPhase(500000L /* yield in 0.5 msec units if needed */);
} finally {
recordingPhaser.readerUnlock();
}
}
private class InternalDoubleHistogram extends DoubleHistogram {
private final long containingInstanceId;
private InternalDoubleHistogram(long id, int numberOfSignificantValueDigits) {
super(numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
private InternalDoubleHistogram(long id,
long highestToLowestValueRatio,
int numberOfSignificantValueDigits) {
super(highestToLowestValueRatio, numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
private InternalDoubleHistogram(InternalDoubleHistogram source) {
super(source);
this.containingInstanceId = source.containingInstanceId;
}
}
private class PackedInternalDoubleHistogram extends PackedDoubleHistogram {
private final long containingInstanceId;
private PackedInternalDoubleHistogram(long id, int numberOfSignificantValueDigits) {
super(numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
}
private void validateFitAsReplacementHistogram(DoubleHistogram replacementHistogram,
boolean enforceContainingInstance) {
boolean bad = true;
if (replacementHistogram == null) {
bad = false;
} else if ((replacementHistogram instanceof InternalDoubleHistogram)
&&
((!enforceContainingInstance) ||
(((InternalDoubleHistogram) replacementHistogram).containingInstanceId ==
((InternalDoubleHistogram)activeHistogram).containingInstanceId)
)) {
bad = false;
} else if ((replacementHistogram instanceof PackedInternalDoubleHistogram)
&&
((!enforceContainingInstance) ||
(((PackedInternalDoubleHistogram) replacementHistogram).containingInstanceId ==
((PackedInternalDoubleHistogram)activeHistogram).containingInstanceId)
)) {
bad = false;
}
if (bad) {
throw new IllegalArgumentException("replacement histogram must have been obtained via a previous " +
"getIntervalHistogram() call from this " + this.getClass().getName() +" instance");
}
}
} |
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithCount(value, count);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
|
HdrHistogram_HdrHistogram | HdrHistogram/src/main/java/org/HdrHistogram/SingleWriterDoubleRecorder.java | SingleWriterDoubleRecorder | recordValueWithExpectedInterval | class SingleWriterDoubleRecorder implements DoubleValueRecorder, IntervalHistogramProvider<DoubleHistogram> {
private static AtomicLong instanceIdSequencer = new AtomicLong(1);
private final long instanceId = instanceIdSequencer.getAndIncrement();
private final WriterReaderPhaser recordingPhaser = new WriterReaderPhaser();
private volatile DoubleHistogram activeHistogram;
private DoubleHistogram inactiveHistogram;
/**
* Construct an auto-resizing {@link SingleWriterDoubleRecorder} using a precision stated as a
* number of significant decimal digits.
* <p>
* Depending on the valuer of the <b><code>packed</code></b> parameter {@link SingleWriterDoubleRecorder} can
* be configured to track value counts in a packed internal representation optimized for typical histogram
* recoded values are sparse in the value range and tend to be incremented in small unit counts. This packed
* representation tends to require significantly smaller amounts of storage when compared to unpacked
* representations, but can incur additional recording cost due to resizing and repacking operations that may
* occur as previously unrecorded values are encountered.
*
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
* @param packed Specifies whether the recorder will uses a packed internal representation or not.
*/
public SingleWriterDoubleRecorder(final int numberOfSignificantValueDigits, final boolean packed) {
activeHistogram = packed ?
new PackedInternalDoubleHistogram(instanceId, numberOfSignificantValueDigits) :
new InternalDoubleHistogram(instanceId, numberOfSignificantValueDigits);
inactiveHistogram = null;
activeHistogram.setStartTimeStamp(System.currentTimeMillis());
}
/**
* Construct an auto-resizing {@link SingleWriterDoubleRecorder} using a precision stated as a
* number of significant decimal digits.
*
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
*/
public SingleWriterDoubleRecorder(final int numberOfSignificantValueDigits) {
this(numberOfSignificantValueDigits, false);
}
/**
* Construct a {@link SingleWriterDoubleRecorder} dynamic range of values to cover and a number
* of significant decimal digits.
*
* @param highestToLowestValueRatio specifies the dynamic range to use (as a ratio)
* @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant
* decimal digits to which the histogram will maintain value resolution
* and separation. Must be a non-negative integer between 0 and 5.
*/
public SingleWriterDoubleRecorder(final long highestToLowestValueRatio,
final int numberOfSignificantValueDigits) {
activeHistogram = new InternalDoubleHistogram(
instanceId, highestToLowestValueRatio, numberOfSignificantValueDigits);
inactiveHistogram = null;
activeHistogram.setStartTimeStamp(System.currentTimeMillis());
}
/**
* Record a value
* @param value the value to record
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValue(final double value) {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValue(value);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
}
/**
* Record a value in the histogram (adding to the value's current count)
*
* @param value The value to be recorded
* @param count The number of occurrences of this value to record
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValueWithCount(final double value, final long count) throws ArrayIndexOutOfBoundsException {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithCount(value, count);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
}
/**
* Record a value
* <p>
* To compensate for the loss of sampled values when a recorded value is larger than the expected
* interval between value samples, Histogram will auto-generate an additional series of decreasingly-smaller
* (down to the expectedIntervalBetweenValueSamples) value records.
* <p>
* See related notes {@link org.HdrHistogram.DoubleHistogram#recordValueWithExpectedInterval(double, double)}
* for more explanations about coordinated omission and expected interval correction.
* *
* @param value The value to record
* @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add
* auto-generated value records as appropriate if value is larger
* than expectedIntervalBetweenValueSamples
* @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
*/
public void recordValueWithExpectedInterval(final double value, final double expectedIntervalBetweenValueSamples)
throws ArrayIndexOutOfBoundsException {<FILL_FUNCTION_BODY>}
@Override
public synchronized DoubleHistogram getIntervalHistogram() {
return getIntervalHistogram(null);
}
@Override
public synchronized DoubleHistogram getIntervalHistogram(DoubleHistogram histogramToRecycle) {
return getIntervalHistogram(histogramToRecycle, true);
}
@Override
public synchronized DoubleHistogram getIntervalHistogram(DoubleHistogram histogramToRecycle,
boolean enforceContainingInstance) {
// Verify that replacement histogram can validly be used as an inactive histogram replacement:
validateFitAsReplacementHistogram(histogramToRecycle, enforceContainingInstance);
inactiveHistogram = histogramToRecycle;
performIntervalSample();
DoubleHistogram sampledHistogram = inactiveHistogram;
inactiveHistogram = null; // Once we expose the sample, we can't reuse it internally until it is recycled
return sampledHistogram;
}
@Override
public synchronized void getIntervalHistogramInto(DoubleHistogram targetHistogram) {
performIntervalSample();
inactiveHistogram.copyInto(targetHistogram);
}
/**
* Reset any value counts accumulated thus far.
*/
public synchronized void reset() {
// the currently inactive histogram is reset each time we flip. So flipping twice resets both:
performIntervalSample();
performIntervalSample();
}
private void performIntervalSample() {
try {
recordingPhaser.readerLock();
// Make sure we have an inactive version to flip in:
if (inactiveHistogram == null) {
if (activeHistogram instanceof InternalDoubleHistogram) {
inactiveHistogram = new InternalDoubleHistogram((InternalDoubleHistogram) activeHistogram);
} else if (activeHistogram instanceof PackedInternalDoubleHistogram) {
inactiveHistogram = new PackedInternalDoubleHistogram(
instanceId, activeHistogram.getNumberOfSignificantValueDigits());
} else {
throw new IllegalStateException("Unexpected internal histogram type for activeHistogram");
}
}
inactiveHistogram.reset();
// Swap active and inactive histograms:
final DoubleHistogram tempHistogram = inactiveHistogram;
inactiveHistogram = activeHistogram;
activeHistogram = tempHistogram;
// Mark end time of previous interval and start time of new one:
long now = System.currentTimeMillis();
activeHistogram.setStartTimeStamp(now);
inactiveHistogram.setEndTimeStamp(now);
// Make sure we are not in the middle of recording a value on the previously active histogram:
// Flip phase to make sure no recordings that were in flight pre-flip are still active:
recordingPhaser.flipPhase(500000L /* yield in 0.5 msec units if needed */);
} finally {
recordingPhaser.readerUnlock();
}
}
private class InternalDoubleHistogram extends DoubleHistogram {
private final long containingInstanceId;
private InternalDoubleHistogram(long id, int numberOfSignificantValueDigits) {
super(numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
private InternalDoubleHistogram(long id,
long highestToLowestValueRatio,
int numberOfSignificantValueDigits) {
super(highestToLowestValueRatio, numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
private InternalDoubleHistogram(InternalDoubleHistogram source) {
super(source);
this.containingInstanceId = source.containingInstanceId;
}
}
private class PackedInternalDoubleHistogram extends PackedDoubleHistogram {
private final long containingInstanceId;
private PackedInternalDoubleHistogram(long id, int numberOfSignificantValueDigits) {
super(numberOfSignificantValueDigits);
this.containingInstanceId = id;
}
}
private void validateFitAsReplacementHistogram(DoubleHistogram replacementHistogram,
boolean enforceContainingInstance) {
boolean bad = true;
if (replacementHistogram == null) {
bad = false;
} else if ((replacementHistogram instanceof InternalDoubleHistogram)
&&
((!enforceContainingInstance) ||
(((InternalDoubleHistogram) replacementHistogram).containingInstanceId ==
((InternalDoubleHistogram)activeHistogram).containingInstanceId)
)) {
bad = false;
} else if ((replacementHistogram instanceof PackedInternalDoubleHistogram)
&&
((!enforceContainingInstance) ||
(((PackedInternalDoubleHistogram) replacementHistogram).containingInstanceId ==
((PackedInternalDoubleHistogram)activeHistogram).containingInstanceId)
)) {
bad = false;
}
if (bad) {
throw new IllegalArgumentException("replacement histogram must have been obtained via a previous " +
"getIntervalHistogram() call from this " + this.getClass().getName() +" instance");
}
}
} |
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithExpectedInterval(value, expectedIntervalBetweenValueSamples);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
|
End of preview. Expand
in Dataset Viewer.
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card- Downloads last month
- 0