Ask is moving to Stack Overflow and! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode


identityref to Java mapping

asked 2015-07-29 10:54:15 -0700

shenh10 gravatar image

Hi folks, I have found some tricky stuff in yang-to-Java mapping. The following snippet:

identity abstractId{
container some-name{
leaf name{
 type identityref{
   base abstractId;

is mapped to a abstract class AbstractId and a SomeName class with an attribute '_name' whose type is 'Class '. Is it correct to be a generic 'Class' in this mapping process?

Actually, I think it is a misbehavior------ The '_name' attribute should have a type whose type is a class extended from AbstractId but not the class itself.

Could anyone tell me is it a bug in yang-dev or my misunderstanding?

Thanks, Han

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-08-30 15:23:13 -0700

Robert Varga gravatar image

Well, since each identity is an abstract singleton, there cannot really be Objects which implement the identity. This is why an identity references are mapped to references to a Class, as the class itself is the identity identifier. The field's tyoe should be Class<? extends AbstractId>.

To set it, you'd use SomeNameBuilder.setName(AbstractId.class);.

edit flag offensive delete publish link more
Login/Signup to Answer


Asked: 2015-07-29 10:54:15 -0700

Seen: 182 times

Last updated: Aug 30 '15