class="java" name="code">import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; @Data @AllArgsConstructor @NoArgsConstructor public class LvsMonitorVip { private String ip; private int port; private String protocol; public static LvsMonitorVip buildLvsMonitorVip(String ip, int port, String protocol) { return new LvsMonitorVip(ip, port, protocol); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof LvsMonitorVip)) { return false; } LvsMonitorVip lvsMonitorVip = (LvsMonitorVip) o; return new EqualsBuilder() .append(port, lvsMonitorVip.port) .append(protocol, lvsMonitorVip.protocol) .append(vip, lvsMonitorVip.vip) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder(17, 37) .append(vip) .append(port) .append(protocol) .toHashCode(); } }
?