Skip to content

Refactor/model impl ontology#45

Merged
lllyfeng merged 3 commits into
mainfrom
refactor/model-impl-ontology
Jul 15, 2026
Merged

Refactor/model impl ontology#45
lllyfeng merged 3 commits into
mainfrom
refactor/model-impl-ontology

Conversation

@lllyfeng

Copy link
Copy Markdown
Contributor

No description provided.

lllyfeng added 3 commits July 9, 2026 14:28
Phase 1 — Eliminate YangBuiltInStatementImpl:
- Move builtinEquals() to YangBuiltinStatement default method
- Add instanceof guard in YangStatementImpl.initSelf() for auto
  substatement validation on all YangBuiltinStatement instances
- Delete YangBuiltInStatementImpl class entirely
- Flatten ~47 subclasses to extend YangStatementImpl directly

Phase 2 — SchemaNodeImpl → SchemaNodeSupport (composition):
- Extract SchemaNodeImpl into SchemaNodeSupport composition class
  (SchemaNode is a role/contract, not a YANG statement ontology)
- All 6 intermediate abstract classes now extend EntityImpl and
  compose SchemaNodeSupport via delegation
- SchemaNode contract methods delegate through schemaNodeSupport

Result: ontology chain (YangStatement → Entity → DataDefinition →
Container/Leaf/...) cleanly separated from role contracts
(SchemaNode, YangBuiltinStatement). 521 tests pass, zero regression.

Co-Authored-By: lllyfeng <fengchongllly@gmail.com>
…upport

YangDataStructureImpl and AugmentStructureImpl now extend EntityImpl
(instead of SchemaNodeImpl) and compose SchemaNodeSupport for
SchemaNode contract methods. This keeps SchemaNode as a clean role
rather than an ontology node, consistent with Phase 2 refactoring.

Also add model-impl unit tests for:
- YangBuiltinStatement.validateSubStatements() and builtinEquals()
- SchemaNodeSupport delegation methods

Co-Authored-By: lllyfeng <fengchongllly@gmail.com>
…odeSupport

- YangBuiltinStatementTest: validates builtinEquals() contract and
  validateSubStatements() default method work regardless of inheritance chain
- SchemaNodeSupportTest: validates SchemaNode delegation methods
  (supported, isMandatory, hasDefault, isAncestorNode, setDeviated, etc.)

Co-Authored-By: lllyfeng <fengchongllly@gmail.com>
@lllyfeng
lllyfeng merged commit 891e8f9 into main Jul 15, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant