protected String constructScalar(ScalarNode node) { return node.getValue(); }
public String toString() { return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue() + ")>"; }
@Override protected Construct getConstructor(Node node) { if (node instanceof MappingNode) { MappingNode mnode = (MappingNode) node; List<NodeTuple> list = mnode.getValue(); if (list.size() == 1) { NodeTuple tuple = list.get(0); Node key = tuple.getKeyNode(); if (key instanceof ScalarNode) { ScalarNode scalar = (ScalarNode) key; if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) { return getCompactConstruct(); } } } } else if (node instanceof ScalarNode) { ScalarNode scalar = (ScalarNode) node; if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) { return getCompactConstruct(); } } return super.getConstructor(node); }
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; String nodeValue = scalar.getValue(); Matcher match = YMD_REGEXP.matcher(nodeValue); if (match.matches()) {
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); } }
|| type == Double.TYPE || type == BigDecimal.class) { if (type == BigDecimal.class) { result = new BigDecimal(node.getValue()); } else { Construct doubleConstructor = yamlConstructors.get(Tag.FLOAT); String enumValueName = node.getValue(); try { result = Enum.valueOf(type, enumValueName); result = contr.construct(node); } else if (UUID.class == type) { result = UUID.fromString(node.getValue()); } else { if (yamlConstructors.containsKey(node.getTag())) {
KeyScalarNode(ScalarNode node) { super(node.getTag(), node.getValue(), node.getStartMark(), node.getEndMark(), node.getScalarStyle()); }
case scalar: ScalarNode scalarNode = (ScalarNode) node; Tag detectedTag = this.resolver.resolve(NodeId.scalar, scalarNode.getValue(), true); Tag defaultTag = this.resolver.resolve(NodeId.scalar, scalarNode.getValue(), false); ImplicitTuple tuple = new ImplicitTuple(node.getTag().equals(detectedTag), node .getTag().equals(defaultTag)); ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple, scalarNode.getValue(), null, null, scalarNode.getStyle()); this.emitter.emit(event); break;
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; return createDependency(scalar.getValue(), new Dependency()); }
/** * Dirty hack - remove 'id' if it is present. * * @param node - the node to remove the coordinate from * @return removed coordinate if it was removed */ private String removeId(MappingNode node) { NodeTuple id = null; String scalar = null; for (NodeTuple tuple : node.getValue()) { ScalarNode keyNode = (ScalarNode) tuple.getKeyNode(); String key = keyNode.getValue(); if ("id".equals(key)) { id = tuple; ScalarNode valueNode = (ScalarNode) tuple.getValueNode(); scalar = valueNode.getValue(); } } if (id != null) { node.getValue().remove(id); } return scalar; } }
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; Coordinate coord = Coordinate.createCoordinate(scalar.getValue()); return coord.mergeParent(new Parent()); } }
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; Coordinate coord = Coordinate.createCoordinate(scalar.getValue()); return coord.mergeReportPlugin(new ReportPlugin()); } }
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; Coordinate coord = Coordinate.createCoordinate(scalar.getValue()); return coord.mergeExtension(new Extension()); } }
@Override public Object construct(Node node) { ScalarNode scalar = (ScalarNode) node; Coordinate coord = Coordinate.createCoordinate(scalar.getValue()); return coord.mergePlugin(new Plugin()); } }
Node keyNode = valueNode.getKeyNode(); Node childValueNode = valueNode.getValueNode(); if (keyNode instanceof ScalarNode && "configuration".equals(((ScalarNode) keyNode).getValue())) { childValueNode.setTag(XPP3DOM_TAG);
@Override public Object construct(Node n) { return ((ScalarNode) n).getValue(); } };
/** * Retrieve String value of a scalar node. * @return String value or null if node is not a Scalar node. */ public static String asScalar(Node node) { if (node!=null && node.getNodeId()==NodeId.scalar) { return ((ScalarNode)node).getValue(); } return null; }
@Override public Object construct(org.yaml.snakeyaml.nodes.Node node) { try { return ValueHelper.deserialize(((ScalarNode) node).getValue(), propertyType, false, valueFactory); } catch (RepositoryException e) { log.error(e.getMessage(), e); return null; } } }
@Override public boolean handles(NodeTuple tuple) { if (tuple.getKeyNode() instanceof ScalarNode) { return fieldName == null || fieldName.equals(((ScalarNode) tuple.getKeyNode()).getValue()); } return false; }