[YANGTOOLS-419] Java Bindings: use cached QNames Created: 12/Mar/15 Updated: 10/Apr/22 Resolved: 16/Mar/15 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | ||
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Description |
|
Each generated class carries a QNAME element inside it, which can be used when interacting with the data in binding independent form. The code looks like this: public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:bgp-rib","2013-09-25","tables");; With advent of cached QName/QNameModule references, we can actually use these to pre-populate cache, such that most of our comparisons end up referencing the same QNameModule/QName object, thus speeding things up. |
| Comments |
| Comment by Robert Varga [ 12/Mar/15 ] |
|
This means that the code in question should become: public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.cachedReference(org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:bgp-rib","2013-09-25","tables")); |
| Comment by Robert Varga [ 12/Mar/15 ] |