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

io.undertow.servlet.api.WebResourceCollection Maven / Gradle / Ivy

The newest version!
/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2014 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package io.undertow.servlet.api;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Stuart Douglas
 */
public class WebResourceCollection implements Cloneable {

    private final Set httpMethods = new HashSet<>();
    private final Set httpMethodOmissions = new HashSet<>();
    private final Set urlPatterns = new HashSet<>();

    public WebResourceCollection addHttpMethod(final String s) {
        httpMethods.add(s);
        return this;
    }

    public WebResourceCollection addHttpMethods(final String... s) {
        httpMethods.addAll(Arrays.asList(s));
        return this;
    }

    public WebResourceCollection addHttpMethods(final Collection s) {
        httpMethods.addAll(s);
        return this;
    }

    public WebResourceCollection addUrlPattern(final String s) {
        urlPatterns.add(s);
        return this;
    }

    public WebResourceCollection addUrlPatterns(final String... s) {
        urlPatterns.addAll(Arrays.asList(s));
        return this;
    }

    public WebResourceCollection addUrlPatterns(final Collection s) {
        urlPatterns.addAll(s);
        return this;
    }

    public WebResourceCollection addHttpMethodOmission(final String s) {
        httpMethodOmissions.add(s);
        return this;
    }

    public WebResourceCollection addHttpMethodOmissions(final String... s) {
        httpMethodOmissions.addAll(Arrays.asList(s));
        return this;
    }

    public WebResourceCollection addHttpMethodOmissions(final Collection s) {
        httpMethodOmissions.addAll(s);
        return this;
    }

    public Set getHttpMethodOmissions() {
        return httpMethodOmissions;
    }

    public Set getUrlPatterns() {
        return urlPatterns;
    }

    public Set getHttpMethods() {
        return httpMethods;
    }

    @Override
    protected WebResourceCollection clone() {
        return new WebResourceCollection()
                .addHttpMethodOmissions(httpMethodOmissions)
                .addHttpMethods(httpMethods)
                .addUrlPatterns(urlPatterns);

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy