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

0

data length in Yang-to-Java mapping

asked 2014-09-10 10:56:54 -0700

anonymous user

Anonymous

Hi all,

When a 8-bit data is defined in Yang, it will be generated to data type of java.lang.Short by yang-to-java in yangtools. However, 16-bit data in yang is also mapped to Integer and 32-bit data is mapped to Long.

Anyone could explain why 16-bit is not mapped to Short and 32 bit is not mapped to Integer, so on so forth.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-09-11 01:12:11 -0700

Tony Tkacik gravatar image

Are types you are trying to use unsigned?

Java itself does not have notion of unsigned bits, so in original design of code generation mapping was envisioned that for unsigned types is used closest higher.

For Binding specification v2 we plan to use types Unsigned types from Google guava, which provides UnsignedShort, UnsignedInteger, UnsignedLong.

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

Question Tools

Follow
1 follower

Stats

Asked: 2014-09-10 10:56:54 -0700

Seen: 55 times

Last updated: Sep 11 '14