All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.hammelion.parsers.RAMLParserFacade Maven / Gradle / Ivy

Go to download

Jraml helps you build your java implementation of REST API, based on specification, described by raml file.

There is a newer version: 0.3
Show newest version
package com.github.hammelion.parsers;

import org.raml.model.Raml;
import org.raml.model.Resource;
import org.raml.parser.visitor.RamlDocumentBuilder;

import javax.inject.Named;
import java.util.HashMap;
import java.util.Map;

/**
 * TODO JavaDoc in org.jraml.parsers
 */
@Named
public class RAMLParserFacade {
    private Map ramlFiles = new HashMap();
    private final RamlDocumentBuilder ramlBuilder = new RamlDocumentBuilder();

    public Resource findResource(String ramlFilePath, String resourceKey) {
        // TODO Validation List results = RamlValidationService.createDefault().validate(ramlLocation);
        Raml raml = this.ramlFiles.get(ramlFilePath);
        if (raml == null) {
            raml = this.ramlBuilder.build(ramlFilePath);
            this.ramlFiles.put(ramlFilePath, raml);
        }
        return raml.getResource(resourceKey);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy