Class AbstractReplaceNodeCommand<T extends Node>
- java.lang.Object
-
- io.apicurio.datamodels.cmd.AbstractCommand
-
- io.apicurio.datamodels.cmd.commands.AbstractReplaceNodeCommand<T>
-
- All Implemented Interfaces:
ICommand
- Direct Known Subclasses:
ReplaceOperationCommand,ReplacePathItemCommand,ReplaceResponseDefinitionCommand,ReplaceSchemaDefinitionCommand
public abstract class AbstractReplaceNodeCommand<T extends Node> extends AbstractCommand
Base class for commands that replace entire nodes.- Author:
- eric.wittmann@gmail.com
-
-
Constructor Summary
Constructors Constructor Description AbstractReplaceNodeCommand()AbstractReplaceNodeCommand(T old, T replacement)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidexecute(Document document)Called to execute the command against the given document.protected abstract TreadNode(Node parent, com.fasterxml.jackson.databind.node.ObjectNode node)Unmarshalls a node into the appropriate type.protected abstract voidreplaceNode(Node parent, T newNode)Replaces the old node entry with the new node in the data model, without changing the order of the nodes.voidundo(Document document)Called to undo the command (restore the document to a previous state).-
Methods inherited from class io.apicurio.datamodels.cmd.AbstractCommand
indexOf, isNullOrUndefined, type
-
-
-
-
Field Detail
-
_nodePath
public NodePath _nodePath
-
_new
public com.fasterxml.jackson.databind.node.ObjectNode _new
-
_old
public com.fasterxml.jackson.databind.node.ObjectNode _old
-
-
Method Detail
-
execute
public void execute(Document document)
Description copied from interface:ICommandCalled to execute the command against the given document.- See Also:
ICommand.execute(Document)
-
undo
public void undo(Document document)
Description copied from interface:ICommandCalled to undo the command (restore the document to a previous state).- See Also:
ICommand.undo(Document)
-
replaceNode
protected abstract void replaceNode(Node parent, T newNode)
Replaces the old node entry with the new node in the data model, without changing the order of the nodes.
-
-