opendaylight:mdsal 如何为 YANG 模型中的特定选择提取数据
opendaylight : mdsal how to extract data for a specific choice in a YANG model
我有一个带有选择节点的阳模型,如下所示:
container matches {
choice l2 {
container eth {
when "derived-from(../../../../type, " +
"'acl:eth-acl-type')";
if-feature match-on-eth;
uses pf:acl-eth-header-fields;
description
"Rule set that matches ethernet headers.";
}
description
"Match layer 2 headers, for example ethernet
header fields.";
}
.....
当我在 DataChangeListener java 代码中收到回调时,我想检索与特定选择对应的数据。当我去查看生成的 class 时,选择字段显然是 com.sun.$Proxy 类型。我可以用这个代理做什么?我怎样才能做到这一点?任何指针将不胜感激。
我不会太担心实现class是com.sun.$Proxy
(这是一个实现细节,它与java.lang.reflect.Proxy
有关),更有趣的是有(应该是)为YANG choice
生成的一个Java接口,不是吗?
如果我理解 https://wiki.opendaylight.org/view/YANG_Tools:YANG_to_Java_Mapping#Choice_and_case 正确,那么生成的接口可以通过 Java 类型转换为特定实例选择的子接口之一?
我有一个带有选择节点的阳模型,如下所示:
container matches {
choice l2 {
container eth {
when "derived-from(../../../../type, " +
"'acl:eth-acl-type')";
if-feature match-on-eth;
uses pf:acl-eth-header-fields;
description
"Rule set that matches ethernet headers.";
}
description
"Match layer 2 headers, for example ethernet
header fields.";
}
.....
当我在 DataChangeListener java 代码中收到回调时,我想检索与特定选择对应的数据。当我去查看生成的 class 时,选择字段显然是 com.sun.$Proxy 类型。我可以用这个代理做什么?我怎样才能做到这一点?任何指针将不胜感激。
我不会太担心实现class是com.sun.$Proxy
(这是一个实现细节,它与java.lang.reflect.Proxy
有关),更有趣的是有(应该是)为YANG choice
生成的一个Java接口,不是吗?
如果我理解 https://wiki.opendaylight.org/view/YANG_Tools:YANG_to_Java_Mapping#Choice_and_case 正确,那么生成的接口可以通过 Java 类型转换为特定实例选择的子接口之一?