This closes #2358
This commit is contained in:
commit
ae738c4260
|
@ -32,6 +32,7 @@ public class AddressInfo {
|
|||
|
||||
private boolean autoCreated = false;
|
||||
|
||||
private static final EnumSet<RoutingType> EMPTY_ROUTING_TYPES = EnumSet.noneOf(RoutingType.class);
|
||||
private EnumSet<RoutingType> routingTypes;
|
||||
private RoutingType firstSeen;
|
||||
|
||||
|
@ -91,26 +92,25 @@ public class AddressInfo {
|
|||
}
|
||||
|
||||
public EnumSet<RoutingType> getRoutingTypes() {
|
||||
return routingTypes;
|
||||
return routingTypes == null ? EMPTY_ROUTING_TYPES : routingTypes;
|
||||
}
|
||||
|
||||
public AddressInfo setRoutingTypes(EnumSet<RoutingType> routingTypes) {
|
||||
public AddressInfo setRoutingTypes(final EnumSet<RoutingType> routingTypes) {
|
||||
this.routingTypes = routingTypes;
|
||||
if (!routingTypes.isEmpty()) {
|
||||
this.firstSeen = this.routingTypes.iterator().next();
|
||||
if (routingTypes != null && !routingTypes.isEmpty()) {
|
||||
this.firstSeen = routingTypes.iterator().next();
|
||||
} else {
|
||||
this.firstSeen = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public AddressInfo addRoutingType(RoutingType routingType) {
|
||||
public AddressInfo addRoutingType(final RoutingType routingType) {
|
||||
if (routingType != null) {
|
||||
if (routingTypes == null) {
|
||||
if (routingTypes == null || routingTypes.isEmpty()) {
|
||||
routingTypes = EnumSet.of(routingType);
|
||||
firstSeen = routingType;
|
||||
} else {
|
||||
if (routingTypes.isEmpty()) {
|
||||
firstSeen = routingType;
|
||||
}
|
||||
routingTypes.add(routingType);
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class AddressInfo {
|
|||
buff.append("Address [name=" + name);
|
||||
buff.append(", id=" + id);
|
||||
buff.append(", routingTypes={");
|
||||
for (RoutingType routingType : routingTypes) {
|
||||
for (RoutingType routingType : getRoutingTypes()) {
|
||||
buff.append(routingType.toString() + ",");
|
||||
}
|
||||
// delete hanging comma
|
||||
|
|
Loading…
Reference in New Issue