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

io.swagger.jaxrs.config.SwaggerScannerLocator Maven / Gradle / Ivy

There is a newer version: 1.6.14
Show newest version
package io.swagger.jaxrs.config;

import io.swagger.config.Scanner;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class SwaggerScannerLocator {

    private static SwaggerScannerLocator instance;

    private ConcurrentMap map = new ConcurrentHashMap();

    public static SwaggerScannerLocator getInstance() {
        if (instance == null) {
            instance = new SwaggerScannerLocator();
        }
        return instance;
    }

    private SwaggerScannerLocator() {
    }

    public Scanner getScanner(String id) {
        Scanner value = map.get(id);
        if (value != null) {
            return value;
        }
        return new DefaultJaxrsScanner();
    }

    public void putScanner(String id, Scanner scanner) {
        if (!map.containsKey(id)) map.put(id, scanner);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy