Search in sources :

Example 6 with MappingTarget

use of alien4cloud.tosca.parser.MappingTarget in project alien4cloud by alien4cloud.

the class SetMappingBuilder method buildMapping.

@Override
public MappingTarget buildMapping(MappingNode mappingNode, ParsingContextExecution context) {
    Map<String, String> map = ParserUtils.parseStringMap(mappingNode, context);
    SetParser parser;
    if (map.get(KEY) == null) {
        parser = baseParserFactory.getSetParser(baseParserFactory.getReferencedParser(map.get(TYPE)), "sequence of " + map.get(TYPE));
    } else {
        parser = baseParserFactory.getSetParser(baseParserFactory.getReferencedParser(map.get(TYPE)), "map of " + map.get(TYPE), map.get(KEY));
    }
    return new MappingTarget(map.get(SET), parser);
}
Also used : SetParser(alien4cloud.tosca.parser.impl.base.SetParser) MappingTarget(alien4cloud.tosca.parser.MappingTarget)

Example 7 with MappingTarget

use of alien4cloud.tosca.parser.MappingTarget in project alien4cloud by alien4cloud.

the class ToscaMetaMapping method initMapping.

@Override
public void initMapping() {
    instance.getYamlToObjectMapping().put("TOSCA-Meta-File-Version", new MappingTarget("", getScalarParser()));
    instance.getYamlToObjectMapping().put("CSAR-Version", new MappingTarget("version", getScalarParser()));
    instance.getYamlToObjectMapping().put("Created-By", new MappingTarget("createdBy", getScalarParser()));
    instance.getYamlToObjectMapping().put("Entry-Definitions", new MappingTarget("entryDefinitions", getScalarParser()));
    instance.getYamlToObjectMapping().put("Name", new MappingTarget("name", getScalarParser()));
    instance.getYamlToObjectMapping().put("Content-Type", new MappingTarget("", getScalarParser()));
}
Also used : MappingTarget(alien4cloud.tosca.parser.MappingTarget)

Example 8 with MappingTarget

use of alien4cloud.tosca.parser.MappingTarget in project alien4cloud by alien4cloud.

the class ListMappingBuilder method buildMapping.

@Override
public MappingTarget buildMapping(MappingNode mappingNode, ParsingContextExecution context) {
    Map<String, String> map = ParserUtils.parseStringMap(mappingNode, context);
    ListParser parser;
    if (map.get(KEY) == null) {
        parser = baseParserFactory.getListParser(baseParserFactory.getReferencedParser(map.get(TYPE)), "sequence of " + map.get(TYPE));
    } else {
        parser = baseParserFactory.getListParser(baseParserFactory.getReferencedParser(map.get(TYPE)), "sequence of " + map.get(TYPE), map.get(KEY));
    }
    return new MappingTarget(map.get(LIST), parser);
}
Also used : ListParser(alien4cloud.tosca.parser.impl.base.ListParser) MappingTarget(alien4cloud.tosca.parser.MappingTarget)

Aggregations

MappingTarget (alien4cloud.tosca.parser.MappingTarget)8 PropertyNamingStrategyBase (com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase)2 NodeTuple (org.yaml.snakeyaml.nodes.NodeTuple)2 INodeParser (alien4cloud.tosca.parser.INodeParser)1 ListParser (alien4cloud.tosca.parser.impl.base.ListParser)1 SetParser (alien4cloud.tosca.parser.impl.base.SetParser)1 MappingNode (org.yaml.snakeyaml.nodes.MappingNode)1