blob: 4744baaa77335d8e4909f95c3962061ac9da6ba3 [file] [log] [blame]
package net.onrc.onos.core.util;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* The class representing the Flow Entry error state.
*/
public class FlowEntryErrorState {
private short type; // The error type (e.g., see OF-1.3.1 spec, pp. 95)
private short code; // The error code (e.g., see OF-1.3.1 spec, pp. 95)
/**
* Default constructor.
*/
public FlowEntryErrorState() {
this.type = 0;
this.code = 0;
}
/**
* Constructor for a given error type and code.
*
* @param type the error type to use.
* @param code the error code to use.
*/
public FlowEntryErrorState(short type, short code) {
this.type = type;
this.code = code;
}
/**
* Get the error type.
*
* @return the error type.
*/
@JsonProperty("type")
public short type() {
return type;
}
/**
* Set the error type.
*
* @param type the error type to use.
*/
@JsonProperty("type")
public void setType(short type) {
this.type = type;
}
/**
* Get the error code.
*
* @return the error code.
*/
@JsonProperty("code")
public short code() {
return code;
}
/**
* Set the error code.
*
* @param code the error code to use.
*/
@JsonProperty("code")
public void setCode(short code) {
this.code = code;
}
/**
* Set the values of the error type and code.
*
* @param newType the error type to use.
* @param newCode the error code to use.
*/
public void setValue(short newType, short newCode) {
type = newType;
code = newCode;
}
/**
* Convert the error type and code to a string.
* <p/>
* The string has the following form:
* [type=1 code=2]
*
* @return the error type and code as a string.
*/
@Override
public String toString() {
String ret = "[type=" + this.type + " code=" + code + "]";
return ret;
}
}