package io.bootique.jetty.server;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

/**
 * @since 0.15
 */
public abstract class WebArtifactFactory {

	private Map<String, String> params;
	private Set<String> urlPatterns;

	/**
	 * @param urlPatterns
	 *            a set of URL patterns for the servlet created by this factory.
	 */
	public void setUrlPatterns(Set<String> urlPatterns) {
		this.urlPatterns = urlPatterns;
	}

	public void setParams(Map<String, String> params) {
		this.params = params;
	}

	protected Map<String, String> getParams(Map<String, String> mappedParams) {

		Map<String, String> params = this.params;
		if (params == null || params.isEmpty()) {
			params = mappedParams;
		}

		if (params == null) {
			params = Collections.emptyMap();
		}
		
		return params;
	}

	protected Set<String> getUrlPatterns(Set<String> mappedPatterns) {

		Set<String> urlPatterns = this.urlPatterns;
		if (urlPatterns == null || urlPatterns.isEmpty()) {
			urlPatterns = mappedPatterns;
		}

		if (urlPatterns == null) {
			urlPatterns = Collections.emptySet();
		}

		return urlPatterns;
	}

}

@@ -28,16 +28,65 @@
 erver;%0A%0A
+import io.bootique.annotation.BQConfigProperty;%0A%0A
 import j
@@ -402,16 +402,35 @@
 y.%0A%09 */%0A
+%09@BQConfigProperty%0A
 %09public 
@@ -514,16 +514,35 @@
 ns;%0A%09%7D%0A%0A
+%09@BQConfigProperty%0A
 %09public 

Upgrade to Bootique 0.21: new app metadata package, annotated config help #56