use of org.alien4cloud.tosca.model.templates.SubstitutionTarget in project alien4cloud by alien4cloud.
the class SustitutionMappingParser method parseSubstitutionTargets.
private Map<String, SubstitutionTarget> parseSubstitutionTargets(Node valueNode, ParsingContextExecution context) {
if (!(valueNode instanceof MappingNode)) {
// we expect a MappingNode
context.getParsingErrors().add(new ParsingError(ErrorCode.YAML_MAPPING_NODE_EXPECTED, null, valueNode.getStartMark(), null, valueNode.getEndMark(), null));
return null;
}
Map<String, SubstitutionTarget> result = Maps.newHashMap();
MappingNode mappingNode = ((MappingNode) valueNode);
List<NodeTuple> nodeTuples = mappingNode.getValue();
for (NodeTuple nodeTuple : nodeTuples) {
String key = scalarParser.parse(nodeTuple.getKeyNode(), context);
SubstitutionTarget target = parseSubstitutionTarget(nodeTuple.getValueNode(), context);
if (target != null) {
result.put(key, target);
}
}
return result;
}
Aggregations