Java tutorial
/* * Copyright 2016 CloudBans (https://cloudbans.xyz) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package xyz.cloudbans.entities.data; import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Date; import java.util.Objects; import java.util.UUID; public class Kick implements Delayable, Issueable { @JsonProperty("id") private UUID id; // Back reference will be ignored by equals(Object) and hashCode() @JsonBackReference @JsonProperty("player_join") private PlayerJoin playerJoin; @JsonProperty("issuer") private Player issuer; @JsonProperty("reason") private String reason; @JsonProperty("issued_at") private Date issuedAt; @JsonProperty("delay_state") private DelayState delayState; public UUID getId() { return id; } public void setId(UUID id) { this.id = id; } public PlayerJoin getPlayerJoin() { return playerJoin; } public void setPlayerJoin(PlayerJoin playerJoin) { this.playerJoin = playerJoin; } @Override public Player getIssuer() { return issuer; } @Override public void setIssuer(Player issuer) { this.issuer = issuer; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public Date getIssuedAt() { return issuedAt; } public void setIssuedAt(Date issuedAt) { this.issuedAt = issuedAt; } @Override public DelayState getDelayState() { return delayState; } @Override public void setDelayState(DelayState delayState) { this.delayState = delayState; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Kick)) return false; Kick that = (Kick) o; return Objects.equals(getId(), that.getId()) && Objects.equals(getIssuer(), that.getIssuer()) && Objects.equals(getReason(), that.getReason()) && Objects.equals(getIssuedAt(), that.getIssuedAt()) && getDelayState() == that.getDelayState(); } @Override public int hashCode() { return Objects.hash(getId(), getIssuer(), getReason(), getIssuedAt(), getDelayState()); } }