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

io.crnk.rs.internal.legacy.RequestContextParameterProviderRegistry Maven / Gradle / Ivy

There is a newer version: 2.6.20180430102904
Show newest version
package io.crnk.rs.internal.legacy;

import io.crnk.core.utils.Optional;
import io.crnk.rs.internal.legacy.provider.Parameter;
import io.crnk.rs.internal.legacy.provider.RequestContextParameterProvider;

import java.util.Collection;
import java.util.Set;

public class RequestContextParameterProviderRegistry {

	private Set parameterProviders;

	public RequestContextParameterProviderRegistry(Set parameterProviders) {
		this.parameterProviders = parameterProviders;
	}

	public Optional findProviderFor(Parameter parameter) {
		for (RequestContextParameterProvider parameterProvider : parameterProviders) {
			if (parameterProvider.provides(parameter)) {
				return Optional.of(parameterProvider);
			}
		}
		return Optional.empty();
	}

	public Collection getParameterProviders() {
		return parameterProviders;
	}

	public void setParameterProviders(Set parameterProviders) {
		this.parameterProviders = parameterProviders;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy