@Override
public String toString() {
StringBuilder builder = new StringBuilder("VBridge[");
+ String prefix;
if (name != null) {
- builder.append("name=").append(name).append(',');
- }
-
- String desc = getDescription();
- if (desc != null) {
- builder.append("desc=").append(desc).append(',');
+ builder.append("name=").append(name);
+ prefix = ",";
+ } else {
+ prefix = "";
}
- int age = getAgeInterval();
- if (age >= 0) {
- builder.append("ageInterval=").append(age).append(',');
+ if (appendContents(builder, prefix)) {
+ prefix = ",";
}
-
- builder.append("faults=").append(faults).
+ builder.append(prefix).append("faults=").append(faults).
append(",state=").append(state.toString()).append("]");
return builder.toString();
/**
* Version number for serialization.
*/
- private static final long serialVersionUID = 7501956469021832807L;
+ private static final long serialVersionUID = 9009552129571959205L;
/**
* An arbitrary description of the vBridge.
}
}
+ /**
+ * Append human readable strings which represents the contents of this
+ * object to the specified {@link StringBuilder}.
+ *
+ * @param builder A {@link StringBuilder} instance.
+ * @param prefix A string to be inserted before contents.
+ * {@code null} must not be specified.
+ * @return {@code true} if at least one character is appended to the
+ * specified {@link StringBuilder} instance.
+ * Otherwise {@code false}.
+ */
+ boolean appendContents(StringBuilder builder, String prefix) {
+ int len = builder.length();
+ String pfx = prefix;
+ if (description != null) {
+ builder.append(pfx).append("desc=").append(description);
+ pfx = ",";
+ }
+ if (ageInterval >= 0) {
+ builder.append(pfx).append("ageInterval=").append(ageInterval);
+ }
+
+ return (builder.length() != len);
+ }
+
/**
* Determine whether the given object is identical to this object.
*
@Override
public String toString() {
StringBuilder builder = new StringBuilder("VBridgeConfig[");
- if (description != null) {
- builder.append("desc=").append(description);
- }
- if (ageInterval >= 0) {
- if (description != null) {
- builder.append(',');
- }
- builder.append("ageInterval=").append(ageInterval);
- }
+ appendContents(builder, "");
builder.append(']');
-
return builder.toString();
}
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("VInterface[");
+ String prefix;
if (name != null) {
- builder.append("name=").append(name).append(',');
- }
-
- String desc = getDescription();
- if (desc != null) {
- builder.append("desc=").append(desc).append(',');
+ builder.append("name=").append(name);
+ prefix = ",";
+ } else {
+ prefix = "";
}
- Boolean en = getEnabled();
- if (en != null) {
- if (en.booleanValue()) {
- builder.append("enabled,");
- } else {
- builder.append("disabled,");
- }
+ if (appendContents(builder, prefix)) {
+ prefix = ",";
}
-
- builder.append("state=").append(state.toString()).
+ builder.append(prefix).append("state=").append(state.toString()).
append(",entityState=").append(entityState.toString()).append(']');
return builder.toString();
/**
* Version number for serialization.
*/
- private static final long serialVersionUID = -6152398562520322469L;
+ private static final long serialVersionUID = 4425846321318048040L;
/**
* An arbitrary description of the virtual interface.
return enabled;
}
+ /**
+ * Append human readable strings which represents the contents of this
+ * object to the specified {@link StringBuilder}.
+ *
+ * @param builder A {@link StringBuilder} instance.
+ * @param prefix A string to be inserted before contents.
+ * {@code null} must not be specified.
+ * @return {@code true} if at least one character is appended to the
+ * specified {@link StringBuilder} instance.
+ * Otherwise {@code false}.
+ */
+ boolean appendContents(StringBuilder builder, String prefix) {
+ int len = builder.length();
+ String pfx = prefix;
+ if (description != null) {
+ builder.append(pfx).append("desc=").append(description);
+ pfx = ",";
+ }
+
+ if (enabled != null) {
+ builder.append(pfx);
+ if (enabled.booleanValue()) {
+ builder.append("enabled");
+ } else {
+ builder.append("disabled");
+ }
+ }
+
+ return (builder.length() != len);
+ }
+
/**
* Determine whether the given object is identical to this object.
*
@Override
public String toString() {
StringBuilder builder = new StringBuilder("VInterfaceConfig[");
- if (description != null) {
- builder.append("desc=").append(description);
- }
-
- if (enabled != null) {
- if (description != null) {
- builder.append(",");
- }
-
- if (enabled.booleanValue()) {
- builder.append("enabled");
- } else {
- builder.append("disabled");
- }
- }
+ appendContents(builder, "");
builder.append(']');
-
return builder.toString();
}
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("VTenant[");
- char sep = 0;
+ String prefix;
if (name != null) {
builder.append("name=").append(name);
- sep = ',';
+ prefix = ",";
+ } else {
+ prefix = "";
}
- String desc = getDescription();
- if (desc != null) {
- if (sep != 0) {
- builder.append(sep);
- }
- builder.append("desc=").append(desc);
- sep = ',';
- }
-
- int idle = getIdleTimeout();
- if (idle >= 0) {
- if (sep != 0) {
- builder.append(sep);
- }
- builder.append("idleTimeout=").append(idle);
- sep = ',';
- }
-
- int hard = getHardTimeout();
- if (hard >= 0) {
- if (sep != 0) {
- builder.append(sep);
- }
- builder.append("hardTimeout=").append(hard);
- }
- builder.append(']');
-
+ appendContents(builder, prefix).append(']');
return builder.toString();
}
}
/**
* Version number for serialization.
*/
- private static final long serialVersionUID = 7446090329841381143L;
+ private static final long serialVersionUID = -2906937162063076543L;
/**
* An arbitrary description of the VTN.
}
}
+ /**
+ * Append human readable strings which represents the contents of this
+ * object to the specified {@link StringBuilder}.
+ *
+ * @param builder A {@link StringBuilder} instance.
+ * @param prefix A string to be inserted before contents.
+ * {@code null} must not be specified.
+ * @return A {@link StringBuilder} instance specified by {@code builder}.
+ */
+ StringBuilder appendContents(StringBuilder builder, String prefix) {
+ String pfx = prefix;
+ if (description != null) {
+ builder.append(pfx).append("desc=").append(description);
+ pfx = ",";
+ }
+
+ if (idleTimeout >= 0) {
+ builder.append(pfx).append("idleTimeout=").append(idleTimeout);
+ pfx = ",";
+ }
+
+ if (hardTimeout >= 0) {
+ builder.append(pfx).append("hardTimeout=").append(hardTimeout);
+ }
+
+ return builder;
+ }
+
/**
* Determine whether the given object is identical to this object.
*
@Override
public String toString() {
StringBuilder builder = new StringBuilder("VTenantConfig[");
- char sep = 0;
- if (description != null) {
- builder.append("desc=").append(description);
- sep = ',';
- }
-
- if (idleTimeout >= 0) {
- if (sep != 0) {
- builder.append(sep);
- }
- builder.append("idleTimeout=").append(idleTimeout);
- sep = ',';
- }
-
- if (hardTimeout >= 0) {
- if (sep != 0) {
- builder.append(sep);
- }
- builder.append("hardTimeout=").append(hardTimeout);
- }
- builder.append(']');
-
+ appendContents(builder, "").append(']');
return builder.toString();
}
}
builder.append("id=").append(id).append(',');
}
- Node node = getNode();
- if (node != null) {
- builder.append("node=").append(node).append(',');
- }
-
- builder.append("vlan=").append((int)getVlan()).append(']');
-
+ appendContents(builder).append(']');
return builder.toString();
}
}
/**
* Version number for serialization.
*/
- private static final long serialVersionUID = -70616068870223019L;
+ private static final long serialVersionUID = 606475725018224880L;
/**
* {@link Node} information corresponding to the physical switch to be
node.equals(anotherNode));
}
+ /**
+ * Append human readable strings which represents the contents of this
+ * object to the specified {@link StringBuilder}.
+ *
+ * @param builder A {@link StringBuilder} instance.
+ * @return A {@link StringBuilder} instance specified by {@code builder}.
+ */
+ StringBuilder appendContents(StringBuilder builder) {
+ if (node != null) {
+ builder.append("node=").append(node.toString()).append(",");
+ }
+
+ return builder.append("vlan=").append((int)vlan);
+ }
+
/**
* Determine whether the given object is identical to this object.
*
@Override
public String toString() {
StringBuilder builder = new StringBuilder("VlanMapConfig[");
- if (node != null) {
- builder.append("node=").append(node.toString()).append(",");
- }
-
- builder.append("vlan=").append((int)vlan).append(']');
-
+ appendContents(builder).append(']');
return builder.toString();
}
}