Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
BUG-2453 (De)Serialize enum values as defined in yang
[controller.git]
/
opendaylight
/
netconf
/
config-netconf-connector
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
confignetconfconnector
/
mapping
/
attributes
/
AttributeIfcSwitchStatement.java
diff --git
a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
index cf0e71e67a52ab9983b5a2599519cf9f3014118c..38c0b06de487ca6b5f2cc5fdd44a36cbb75e7ffe 100644
(file)
--- a/
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
+++ b/
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
@@
-8,6
+8,10
@@
package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes;
package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes;
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute;
@@
-16,14
+20,9
@@
import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDepende
import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute;
import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute;
import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-
public abstract class AttributeIfcSwitchStatement<T> {
public abstract class AttributeIfcSwitchStatement<T> {
- pr
otected
AttributeIfc lastAttribute;
+ pr
ivate
AttributeIfc lastAttribute;
public T switchAttribute(AttributeIfc attributeIfc) {
public T switchAttribute(AttributeIfc attributeIfc) {
@@
-37,8
+36,13
@@
public abstract class AttributeIfcSwitchStatement<T> {
return caseJavaBinaryAttribute(openType);
} else if(((JavaAttribute)attributeIfc).isUnion()) {
return caseJavaUnionAttribute(openType);
return caseJavaBinaryAttribute(openType);
} else if(((JavaAttribute)attributeIfc).isUnion()) {
return caseJavaUnionAttribute(openType);
- } else
+ } else if(((JavaAttribute)attributeIfc).isIdentityRef()) {
+ return caseJavaIdentityRefAttribute(openType);
+ } else if(((JavaAttribute)attributeIfc).isEnum()) {
+ return caseJavaEnumAttribute(openType);
+ } else {
return caseJavaAttribute(openType);
return caseJavaAttribute(openType);
+ }
} catch (UnknownOpenTypeException e) {
throw getIllegalArgumentException(attributeIfc);
}
} catch (UnknownOpenTypeException e) {
throw getIllegalArgumentException(attributeIfc);
}
@@
-56,10
+60,22
@@
public abstract class AttributeIfcSwitchStatement<T> {
throw getIllegalArgumentException(attributeIfc);
}
throw getIllegalArgumentException(attributeIfc);
}
+ public AttributeIfc getLastAttribute() {
+ return lastAttribute;
+ }
+
+ protected T caseJavaIdentityRefAttribute(OpenType<?> openType) {
+ return caseJavaAttribute(openType);
+ }
+
protected T caseJavaUnionAttribute(OpenType<?> openType) {
return caseJavaAttribute(openType);
}
protected T caseJavaUnionAttribute(OpenType<?> openType) {
return caseJavaAttribute(openType);
}
+ protected T caseJavaEnumAttribute(OpenType<?> openType) {
+ return caseJavaAttribute(openType);
+ }
+
protected T caseJavaBinaryAttribute(OpenType<?> openType) {
return caseJavaAttribute(openType);
}
protected T caseJavaBinaryAttribute(OpenType<?> openType) {
return caseJavaAttribute(openType);
}
@@
-96,6
+112,8
@@
public abstract class AttributeIfcSwitchStatement<T> {
protected abstract T caseListDependeciesAttribute(ArrayType<?> openType);
private static class UnknownOpenTypeException extends RuntimeException {
protected abstract T caseListDependeciesAttribute(ArrayType<?> openType);
private static class UnknownOpenTypeException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
public UnknownOpenTypeException(String message) {
super(message);
}
public UnknownOpenTypeException(String message) {
super(message);
}