[YANGTOOLS-496] yang-model-api: Cleanup TypeDefinition Created: 07/Sep/15  Updated: 10/Apr/22  Resolved: 16/Oct/16

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
Platform: All


Issue Links:
Blocks
is blocked by YANGTOOLS-547 yang-model-util: Cleanup TypeDefiniti... Resolved

 Description   

The model API's interface class hierarchy regarding types is confusing for users. There are three basic concepts, which are intertwined:

TypeDefinition, which is the top-level interface
ExtendedType, which is a public non-final class implementing it
DerivedType, which is an attempt to clean up TypeDefiniton and ExtendedType relationship.

This is not accurate as to what is actually going on, what we really have are two sets of interfaces:

1) TypeSemantics, which equals TypeDefinition without getBaseType(), and defines the basic semantic group (integer, string, etc.), but not things like range of allowed values.

2) TypeDefinition, which defines the actual type, with ranges and other restrictions. It also provides a getTypeSemantics() method, which returns a TypeSemantics which this particular TypeDefinition follows.

There is also a DerivedTypeDefinition, which is a subclass of TypeDefinition, which adds a getSuperType() method – this returns the TypeDefinition from which this type is derived.

All user-defined types implement DerivedTypeDefinition. All built-in types implement TypeDefinition only.

This is a strawman proposal, which needs to be fleshed out, especially the individual concepts need to be made clear.



 Comments   
Comment by Robert Varga [ 18/Nov/15 ]

Length/range constraint clarifications:
https://git.opendaylight.org/gerrit/29883
https://git.opendaylight.org/gerrit/29884

Comment by Robert Varga [ 08/Jun/16 ]

This has been implemented in model.util.type package. The only remaining task is to remove DerivedType, ExtendedType and all the public base types in model.util.

Comment by Robert Varga [ 16/Oct/16 ]

Fixed in Boron.

Generated at Wed Feb 07 20:53:25 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.