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

io.cucumber.junit.platform.engine.CachingFeatureParser Maven / Gradle / Ivy

There is a newer version: 7.20.1
Show newest version
package io.cucumber.junit.platform.engine;

import io.cucumber.core.feature.FeatureParser;
import io.cucumber.core.gherkin.Feature;
import io.cucumber.core.resource.Resource;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

class CachingFeatureParser {

    private final Map> cache = new HashMap<>();
    private final FeatureParser delegate;

    CachingFeatureParser(FeatureParser delegate) {
        this.delegate = delegate;
    }

    Optional parseResource(Resource resource) {
        return cache.computeIfAbsent(resource.getUri(), uri -> delegate.parseResource(resource));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy