summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
320a4e5)
Add String value fields to ErrorSeverity and ErrorType enums that
contain lowercase names of enums. Enums' string value getter methods
return these lowercase values.
Change-Id: I1509a7bbae4811025a5bbba11e9b2f0c0cc75b50
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
import static org.opendaylight.controller.config.util.xml.XmlMappingConstants.RPC_REPLY_KEY;
import static org.opendaylight.controller.config.util.xml.XmlMappingConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
import static org.opendaylight.controller.config.util.xml.XmlMappingConstants.RPC_REPLY_KEY;
import static org.opendaylight.controller.config.util.xml.XmlMappingConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
+
+import com.google.common.base.Preconditions;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
}
public enum ErrorType {
}
public enum ErrorType {
- TRANSPORT, RPC, PROTOCOL, APPLICATION;
+ TRANSPORT("transport"),
+ RPC("rpc"),
+ PROTOCOL("protocol"),
+ APPLICATION("application");
+
+ private final String typeValue;
+
+ ErrorType(String typeValue) {
+ this.typeValue = Preconditions.checkNotNull(typeValue);
+ }
public String getTypeValue() {
public String getTypeValue() {
*/
@Deprecated
public String getTagValue() {
*/
@Deprecated
public String getTagValue() {
- public static ErrorType from( String text ) {
- try {
- return valueOf( text.toUpperCase() );
- }
- catch( Exception e ) {
- return APPLICATION;
+ public static ErrorType from(String text) {
+ for (ErrorType e : values()) {
+ if (e.getTypeValue().equalsIgnoreCase(text)) {
+ return e;
+ }
}
public enum ErrorSeverity {
}
public enum ErrorSeverity {
+ ERROR("error"),
+ WARNING("warning");
+
+ private final String severityValue;
+
+ ErrorSeverity(String severityValue) {
+ this.severityValue = Preconditions.checkNotNull(severityValue);
+ }
public String getSeverityValue() {
public String getSeverityValue() {
+ return this.severityValue;
*/
@Deprecated
public String getTagValue() {
*/
@Deprecated
public String getTagValue() {
+ return this.severityValue;
- public static ErrorSeverity from( String text ) {
- try {
- return valueOf( text.toUpperCase() );
- }
- catch( Exception e ) {
- return ERROR;
+ public static ErrorSeverity from(String text) {
+ for (ErrorSeverity e : values()) {
+ if (e.getSeverityValue().equalsIgnoreCase(text)) {
+ return e;
+ }