Ask Your Question

data length in Yang-to-Java mapping

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

anonymous user


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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower


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

Seen: 53 times

Last updated: Sep 11 '14