public Object construct(Node node) { ScalarNode tmpNode; if (node instanceof MappingNode) { // Compact Object Notation may contain only one entry MappingNode mnode = (MappingNode) node; NodeTuple nodeTuple = mnode.getValue().iterator().next(); node.setTwoStepsConstruction(true); tmpNode = (ScalarNode) nodeTuple.getKeyNode(); // return constructScalar((ScalarNode) keyNode); } else { tmpNode = (ScalarNode) node; } CompactData data = getCompactData(tmpNode.getValue()); if (data == null) { // TODO: Should we throw an exception here ? return constructScalar(tmpNode); } return constructCompactFormat(tmpNode, data); } }
private Node composeNode(Node parent) { if (parent != null) recursiveNodes.add(parent); final Node node; if (parser.checkEvent(Event.ID.Alias)) { AliasEvent event = (AliasEvent) parser.getEvent(); String anchor = event.getAnchor(); if (!anchors.containsKey(anchor)) { throw new ComposerException(null, null, "found undefined alias " + anchor, event.getStartMark()); } node = anchors.get(anchor); if (recursiveNodes.remove(node)) { node.setTwoStepsConstruction(true); } } else { NodeEvent event = (NodeEvent) parser.peekEvent(); String anchor = event.getAnchor(); // the check for duplicate anchors has been removed (issue 174) if (parser.checkEvent(Event.ID.Scalar)) { node = composeScalarNode(anchor); } else if (parser.checkEvent(Event.ID.SequenceStart)) { node = composeSequenceNode(anchor); } else { node = composeMappingNode(anchor); } } recursiveNodes.remove(parent); return node; }
public Object construct(Node node) { ScalarNode tmpNode = null; if (node instanceof MappingNode) { // Compact Object Notation may contain only one entry MappingNode mnode = (MappingNode) node; NodeTuple nodeTuple = mnode.getValue().iterator().next(); node.setTwoStepsConstruction(true); tmpNode = (ScalarNode) nodeTuple.getKeyNode(); // return constructScalar((ScalarNode) keyNode); } else { tmpNode = (ScalarNode) node; } CompactData data = getCompactData(tmpNode.getValue()); if (data == null) { // TODO: Should we throw an exception here ? return constructScalar(tmpNode); } return constructCompactFormat(tmpNode, data); } }
public Object construct(Node node) { ScalarNode tmpNode = null; if (node instanceof MappingNode) { // Compact Object Notation may contain only one entry MappingNode mnode = (MappingNode) node; NodeTuple nodeTuple = mnode.getValue().iterator().next(); node.setTwoStepsConstruction(true); tmpNode = (ScalarNode) nodeTuple.getKeyNode(); // return constructScalar((ScalarNode) keyNode); } else { tmpNode = (ScalarNode) node; } CompactData data = getCompactData(tmpNode.getValue()); if (data == null) { // TODO: Should we throw an exception here ? return constructScalar(tmpNode); } return constructCompactFormat(tmpNode, data); } }
public Object construct(Node node) { ScalarNode tmpNode = null; if (node instanceof MappingNode) { // Compact Object Notation may contain only one entry MappingNode mnode = (MappingNode) node; NodeTuple nodeTuple = mnode.getValue().iterator().next(); node.setTwoStepsConstruction(true); tmpNode = (ScalarNode) nodeTuple.getKeyNode(); // return constructScalar((ScalarNode) keyNode); } else { tmpNode = (ScalarNode) node; } CompactData data = getCompactData(tmpNode.getValue()); if (data == null) { // TODO: Should we throw an exception here ? return constructScalar(tmpNode); } return constructCompactFormat(tmpNode, data); } }
private Node composeNode(Node parent) { recursiveNodes.add(parent); if (parser.checkEvent(Event.ID.Alias)) { AliasEvent event = (AliasEvent) parser.getEvent(); String anchor = event.getAnchor(); if (!anchors.containsKey(anchor)) { throw new ComposerException(null, null, "found undefined alias " + anchor, event.getStartMark()); } Node result = anchors.get(anchor); if (recursiveNodes.remove(result)) { result.setTwoStepsConstruction(true); } return result; } NodeEvent event = (NodeEvent) parser.peekEvent(); String anchor = null; anchor = event.getAnchor(); // the check for duplicate anchors has been removed (issue 174) Node node = null; if (parser.checkEvent(Event.ID.Scalar)) { node = composeScalarNode(anchor); } else if (parser.checkEvent(Event.ID.SequenceStart)) { node = composeSequenceNode(anchor); } else { node = composeMappingNode(anchor); } recursiveNodes.remove(parent); return node; }
private Node composeNode(Node parent) { recursiveNodes.add(parent); Node node = null; if (parser.checkEvent(Event.ID.Alias)) { AliasEvent event = (AliasEvent) parser.getEvent(); String anchor = event.getAnchor(); if (!anchors.containsKey(anchor)) { throw new ComposerException(null, null, "found undefined alias " + anchor, event.getStartMark()); } node = anchors.get(anchor); if (recursiveNodes.remove(node)) { node.setTwoStepsConstruction(true); } } else { NodeEvent event = (NodeEvent) parser.peekEvent(); String anchor = null; anchor = event.getAnchor(); // the check for duplicate anchors has been removed (issue 174) if (parser.checkEvent(Event.ID.Scalar)) { node = composeScalarNode(anchor); } else if (parser.checkEvent(Event.ID.SequenceStart)) { node = composeSequenceNode(anchor); } else { node = composeMappingNode(anchor); } } recursiveNodes.remove(parent); return node; }
private Node composeNode(Node parent) { recursiveNodes.add(parent); Node node = null; if (parser.checkEvent(Event.ID.Alias)) { AliasEvent event = (AliasEvent) parser.getEvent(); String anchor = event.getAnchor(); if (!anchors.containsKey(anchor)) { throw new ComposerException(null, null, "found undefined alias " + anchor, event.getStartMark()); } node = anchors.get(anchor); if (recursiveNodes.remove(node)) { node.setTwoStepsConstruction(true); } } else { NodeEvent event = (NodeEvent) parser.peekEvent(); String anchor = null; anchor = event.getAnchor(); // the check for duplicate anchors has been removed (issue 174) if (parser.checkEvent(Event.ID.Scalar)) { node = composeScalarNode(anchor); } else if (parser.checkEvent(Event.ID.SequenceStart)) { node = composeSequenceNode(anchor); } else { node = composeMappingNode(anchor); } } recursiveNodes.remove(parent); return node; }