1 package org.olsr.v1.info.api.dto; 2 3 import java.util.LinkedList; 4 import java.util.List; 5 6 import org.olsr.v1.info.api.commands.InfoCommand; 7 import org.osgi.annotation.versioning.ProviderType; 8 9 import com.fasterxml.jackson.annotation.JsonProperty; 10 11 /** 12 * The container of the {@link InfoCommand#INTERFACES} jsoninfo OLSRd plugin response 13 */ 14 @ProviderType 15 public class JsonInfoInterfaces extends JsonInfoBase { 16 private final List<JsonInfoInterfacesEntry> interfaces = new LinkedList<>(); 17 18 /** 19 * @return the interfaces response 20 */ getInterfaces()21 public List<JsonInfoInterfacesEntry> getInterfaces() { 22 return this.interfaces; 23 } 24 25 /** 26 * @param interfaces the interfaces response to set 27 */ 28 @JsonProperty("interfaces") setInterfaces(final List<JsonInfoInterfacesEntry> interfaces)29 public void setInterfaces(final List<JsonInfoInterfacesEntry> interfaces) { 30 this.interfaces.clear(); 31 if (interfaces != null) { 32 this.interfaces.addAll(interfaces); 33 } 34 } 35 36 @Override hashCode()37 public int hashCode() { 38 final int prime = 31; 39 int result = super.hashCode(); 40 result = (prime * result) + this.interfaces.hashCode(); 41 return result; 42 } 43 44 @Override equals(final Object obj)45 public boolean equals(final Object obj) { 46 if (this == obj) { 47 return true; 48 } 49 if (!super.equals(obj)) { 50 return false; 51 } 52 /* class comparison is already done in super.equals() */ 53 final JsonInfoInterfaces other = (JsonInfoInterfaces) obj; 54 55 if (!this.interfaces.equals(other.interfaces)) { 56 return false; 57 } 58 return true; 59 } 60 61 @Override toString()62 public String toString() { 63 final StringBuilder builder = new StringBuilder(); 64 builder.append("JsonInfoInterfaces [interfaces="); 65 builder.append(this.interfaces); 66 builder.append(", "); 67 builder.append(super.toString()); 68 builder.append("]"); 69 return builder.toString(); 70 } 71 }