org.mockserver.model.RegexBody Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockserver-core Show documentation
Show all versions of mockserver-core Show documentation
Functionality used by all MockServer modules for matching and expectations
package org.mockserver.model;
import java.util.Objects;
/**
* @author jamesdbloom
*/
public class RegexBody extends Body {
private int hashCode;
private final String regex;
public RegexBody(String regex) {
super(Type.REGEX);
this.regex = regex;
}
public String getValue() {
return regex;
}
public static RegexBody regex(String regex) {
return new RegexBody(regex);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (hashCode() != o.hashCode()) {
return false;
}
if (!super.equals(o)) {
return false;
}
RegexBody regexBody = (RegexBody) o;
return Objects.equals(regex, regexBody.regex);
}
@Override
public int hashCode() {
if (hashCode == 0) {
hashCode = Objects.hash(super.hashCode(), regex);
}
return hashCode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy