io.swagger.v3.jaxrs2.ext.OpenAPIExtensions Maven / Gradle / Ivy
package io.swagger.v3.jaxrs2.ext;
import io.swagger.v3.jaxrs2.DefaultParameterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
public class OpenAPIExtensions {
private static final Logger LOGGER = LoggerFactory.getLogger(OpenAPIExtensions.class);
private static List extensions = null;
public static List getExtensions() {
return extensions;
}
public static void setExtensions(List ext) {
extensions = ext;
}
public static Iterator chain() {
return extensions.iterator();
}
static {
extensions = new ArrayList<>();
ServiceLoader loader = ServiceLoader.load(OpenAPIExtension.class);
for (OpenAPIExtension ext : loader) {
LOGGER.debug("adding extension {}", ext);
extensions.add(ext);
}
extensions.add(new DefaultParameterExtension());
}
}