Commit 184528cf by Johannes Edmeier

Remove commons-lang dependent code

parent a84f581e
...@@ -26,11 +26,6 @@ public class ClientApplicationDeregisteredEvent extends ClientApplicationEvent { ...@@ -26,11 +26,6 @@ public class ClientApplicationDeregisteredEvent extends ClientApplicationEvent {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public ClientApplicationDeregisteredEvent(Application application) { public ClientApplicationDeregisteredEvent(Application application) {
super(application); super(application, "DEREGISTRATION");
}
@Override
public String getType() {
return "DEREGISTRATION";
} }
} }
...@@ -17,9 +17,6 @@ package de.codecentric.boot.admin.event; ...@@ -17,9 +17,6 @@ package de.codecentric.boot.admin.event;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import de.codecentric.boot.admin.model.Application; import de.codecentric.boot.admin.model.Application;
/** /**
...@@ -33,10 +30,12 @@ public abstract class ClientApplicationEvent implements Serializable { ...@@ -33,10 +30,12 @@ public abstract class ClientApplicationEvent implements Serializable {
private final Application application; private final Application application;
private final long timestamp; private final long timestamp;
private final String type;
public ClientApplicationEvent(Application application) { protected ClientApplicationEvent(Application application, String type) {
this.application = application; this.application = application;
this.timestamp = System.currentTimeMillis(); this.timestamp = System.currentTimeMillis();
this.type = type;
} }
/** /**
...@@ -56,12 +55,18 @@ public abstract class ClientApplicationEvent implements Serializable { ...@@ -56,12 +55,18 @@ public abstract class ClientApplicationEvent implements Serializable {
/** /**
* Return the event type (for JSON). * Return the event type (for JSON).
*/ */
public abstract String getType(); public String getType() {
return type;
}
@Override @Override
public int hashCode() { public int hashCode() {
return new HashCodeBuilder().append(application).append(timestamp).append(getType()) final int prime = 31;
.toHashCode(); int result = 1;
result = prime * result + ((application == null) ? 0 : application.hashCode());
result = prime * result + (int) (timestamp ^ (timestamp >>> 32));
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
} }
@Override @Override
...@@ -76,9 +81,23 @@ public abstract class ClientApplicationEvent implements Serializable { ...@@ -76,9 +81,23 @@ public abstract class ClientApplicationEvent implements Serializable {
return false; return false;
} }
ClientApplicationEvent other = (ClientApplicationEvent) obj; ClientApplicationEvent other = (ClientApplicationEvent) obj;
return new EqualsBuilder().append(this.application, other.application) if (application == null) {
.append(this.timestamp, other.timestamp).append(this.getType(), other.getType()) if (other.application != null) {
.isEquals(); return false;
}
} else if (!application.equals(other.application)) {
return false;
}
if (timestamp != other.timestamp) {
return false;
}
if (type == null) {
if (other.type != null) {
return false;
}
} else if (!type.equals(other.type)) {
return false;
}
return true;
} }
} }
...@@ -26,11 +26,6 @@ public class ClientApplicationRegisteredEvent extends ClientApplicationEvent { ...@@ -26,11 +26,6 @@ public class ClientApplicationRegisteredEvent extends ClientApplicationEvent {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public ClientApplicationRegisteredEvent(Application application) { public ClientApplicationRegisteredEvent(Application application) {
super(application); super(application, "REGISTRATION");
}
@Override
public String getType() {
return "REGISTRATION";
} }
} }
...@@ -30,7 +30,7 @@ public class ClientApplicationStatusChangedEvent extends ClientApplicationEvent ...@@ -30,7 +30,7 @@ public class ClientApplicationStatusChangedEvent extends ClientApplicationEvent
public ClientApplicationStatusChangedEvent(Application application, StatusInfo from, public ClientApplicationStatusChangedEvent(Application application, StatusInfo from,
StatusInfo to) { StatusInfo to) {
super(application); super(application, "STATUS_CHANGE");
this.from = from; this.from = from;
this.to = to; this.to = to;
} }
...@@ -42,9 +42,4 @@ public class ClientApplicationStatusChangedEvent extends ClientApplicationEvent ...@@ -42,9 +42,4 @@ public class ClientApplicationStatusChangedEvent extends ClientApplicationEvent
public StatusInfo getTo() { public StatusInfo getTo() {
return to; return to;
} }
@Override
public String getType() {
return "STATUS_CHANGE";
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment