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

com.gitlab.spacetrucker.modularspringcontexts.module.ChainedNamespaceHandlerResolver Maven / Gradle / Ivy

There is a newer version: 0.3.2
Show newest version
package com.gitlab.spacetrucker.modularspringcontexts.module;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.xml.NamespaceHandler;
import org.springframework.beans.factory.xml.NamespaceHandlerResolver;

/**
 * {@link NamespaceHandlerResolver} implementation that manages a list of
 * {@code NamespaceHandlerResolver}s. The {@link NamespaceHandler} of the first
 * resolver that is able to resolve a given {@code namespaceUri} is chosen.
 */
public class ChainedNamespaceHandlerResolver implements NamespaceHandlerResolver {

	private List resolvers = new ArrayList<>();

	@Override
	public NamespaceHandler resolve(String namespaceUri) {
		for (NamespaceHandlerResolver resolver : resolvers) {
			NamespaceHandler resolved = resolver.resolve(namespaceUri);
			if (resolved != null) {
				return resolved;
			}
		}
		return null;
	}

	public void setResolvers(List resolvers) {
		this.resolvers = resolvers;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy