public interface IReferenceManipulationStrategy
Each schema may work with references in a different way, so an implementation
of this interface is provided for each Document
type.
Modifier and Type | Interface and Description |
---|---|
static class |
IReferenceManipulationStrategy.ReferenceAndNode |
Modifier and Type | Method and Description |
---|---|
IReferenceManipulationStrategy.ReferenceAndNode |
attachAsDefinition(Document model,
String name,
Node component)
Add the node to the document (wrapped) as a component/definition.
|
Map<String,Node> |
getExistingLocalComponents(Document model)
Get a collection of local components/definitions, mapped by their local reference string.
|
IReferenceManipulationStrategy.ReferenceAndNode attachAsDefinition(Document model, String name, Node component)
Given a node, if it can be represented as a IDefinition
,
it's wrapped into one and attached to the appropriate place in the document.
This new definition node is returned (the original itself is not attached), together with a canonical reference to the new definition.
The reference is generated from the provided name. If a definition with the provided name
already exists, throw an IllegalArgumentException
.
model
- Target model to manipulatename
- Suggested definition namecomponent
- Node to be attached as a definitionIllegalArgumentException
- if there is a naming conflict. // TODO some better way?Copyright © 2020 Red Hat. All rights reserved.