1 package org.opendaylight.controller.sal.core;
3 import javax.xml.bind.annotation.XmlAccessType;
4 import javax.xml.bind.annotation.XmlAccessorType;
5 import javax.xml.bind.annotation.XmlElement;
6 import javax.xml.bind.annotation.XmlRootElement;
9 * The class represents the forwarding mode property of a node.
12 @XmlAccessorType(XmlAccessType.NONE)
13 @SuppressWarnings("serial")
14 public class ForwardingMode extends Property {
15 @XmlElement(name="value")
16 private final int modeValue;
17 public static final int REACTIVE_FORWARDING = 0;
18 public static final int PROACTIVE_FORWARDING = 1;
19 public static final String name = "forwarding";
22 * Private constructor used for JAXB mapping
24 private ForwardingMode() {
26 this.modeValue = REACTIVE_FORWARDING;
29 public ForwardingMode(int mode) {
31 this.modeValue = mode;
34 public int getValue() {
35 return this.modeValue;
38 public boolean isProactive() {
39 return (modeValue == ForwardingMode.PROACTIVE_FORWARDING);
42 public boolean isValid() {
43 return ((modeValue >= 0) && (modeValue <= 1));
47 public ForwardingMode clone() {
48 return new ForwardingMode(this.modeValue);
52 public int hashCode() {
54 int result = super.hashCode();
55 result = prime * result + modeValue;
60 public boolean equals(Object obj) {
63 if (!super.equals(obj))
65 if (getClass() != obj.getClass())
67 ForwardingMode other = (ForwardingMode) obj;
68 if (modeValue != other.modeValue)
74 public String toString() {
75 return "Mode[" + modeValue + "]";
79 public String getStringValue() {
80 return (modeValue == ForwardingMode.PROACTIVE_FORWARDING) ? "Proactive" : "Reactive";