Skip to content
This repository was archived by the owner on Jun 29, 2018. It is now read-only.

Commit 184528c

Browse files
committed
Remove commons-lang dependent code
1 parent a84f581 commit 184528c

4 files changed

Lines changed: 33 additions & 29 deletions

File tree

spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/event/ClientApplicationDeregisteredEvent.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public class ClientApplicationDeregisteredEvent extends ClientApplicationEvent {
2626
private static final long serialVersionUID = 1L;
2727

2828
public ClientApplicationDeregisteredEvent(Application application) {
29-
super(application);
30-
}
31-
32-
@Override
33-
public String getType() {
34-
return "DEREGISTRATION";
29+
super(application, "DEREGISTRATION");
3530
}
3631
}

spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/event/ClientApplicationEvent.java

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
import java.io.Serializable;
1919

20-
import org.apache.commons.lang.builder.EqualsBuilder;
21-
import org.apache.commons.lang.builder.HashCodeBuilder;
22-
2320
import de.codecentric.boot.admin.model.Application;
2421

2522
/**
@@ -33,10 +30,12 @@ public abstract class ClientApplicationEvent implements Serializable {
3330
private final Application application;
3431

3532
private final long timestamp;
33+
private final String type;
3634

37-
public ClientApplicationEvent(Application application) {
35+
protected ClientApplicationEvent(Application application, String type) {
3836
this.application = application;
3937
this.timestamp = System.currentTimeMillis();
38+
this.type = type;
4039
}
4140

4241
/**
@@ -56,12 +55,18 @@ public Application getApplication() {
5655
/**
5756
* Return the event type (for JSON).
5857
*/
59-
public abstract String getType();
58+
public String getType() {
59+
return type;
60+
}
6061

6162
@Override
6263
public int hashCode() {
63-
return new HashCodeBuilder().append(application).append(timestamp).append(getType())
64-
.toHashCode();
64+
final int prime = 31;
65+
int result = 1;
66+
result = prime * result + ((application == null) ? 0 : application.hashCode());
67+
result = prime * result + (int) (timestamp ^ (timestamp >>> 32));
68+
result = prime * result + ((type == null) ? 0 : type.hashCode());
69+
return result;
6570
}
6671

6772
@Override
@@ -76,9 +81,23 @@ public boolean equals(Object obj) {
7681
return false;
7782
}
7883
ClientApplicationEvent other = (ClientApplicationEvent) obj;
79-
return new EqualsBuilder().append(this.application, other.application)
80-
.append(this.timestamp, other.timestamp).append(this.getType(), other.getType())
81-
.isEquals();
84+
if (application == null) {
85+
if (other.application != null) {
86+
return false;
87+
}
88+
} else if (!application.equals(other.application)) {
89+
return false;
90+
}
91+
if (timestamp != other.timestamp) {
92+
return false;
93+
}
94+
if (type == null) {
95+
if (other.type != null) {
96+
return false;
97+
}
98+
} else if (!type.equals(other.type)) {
99+
return false;
100+
}
101+
return true;
82102
}
83-
84103
}

spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/event/ClientApplicationRegisteredEvent.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public class ClientApplicationRegisteredEvent extends ClientApplicationEvent {
2626
private static final long serialVersionUID = 1L;
2727

2828
public ClientApplicationRegisteredEvent(Application application) {
29-
super(application);
30-
}
31-
32-
@Override
33-
public String getType() {
34-
return "REGISTRATION";
29+
super(application, "REGISTRATION");
3530
}
3631
}

spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/event/ClientApplicationStatusChangedEvent.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ClientApplicationStatusChangedEvent extends ClientApplicationEvent
3030

3131
public ClientApplicationStatusChangedEvent(Application application, StatusInfo from,
3232
StatusInfo to) {
33-
super(application);
33+
super(application, "STATUS_CHANGE");
3434
this.from = from;
3535
this.to = to;
3636
}
@@ -42,9 +42,4 @@ public StatusInfo getFrom() {
4242
public StatusInfo getTo() {
4343
return to;
4444
}
45-
46-
@Override
47-
public String getType() {
48-
return "STATUS_CHANGE";
49-
}
5045
}

0 commit comments

Comments
 (0)