blob: 472f3c781d55a49b07827ec452f6c7fa55bcdff4 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../../jacoco-resources/report.gif" type="image/gif"/><title>SimpleNamedFilterList.java</title><link rel="stylesheet" href="../../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../../index.html" class="el_report">Apache Shiro :: All (aggregate jar)</a> &gt; <a href="../index.html" class="el_bundle">shiro-web</a> &gt; <a href="index.source.html" class="el_package">org.apache.shiro.web.filter.mgt</a> &gt; <span class="el_source">SimpleNamedFilterList.java</span></div><h1>SimpleNamedFilterList.java</h1><pre class="source lang-java linenums">/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* &quot;License&quot;); 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
* &quot;AS IS&quot; 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 org.apache.shiro.web.filter.mgt;
import org.apache.shiro.util.StringUtils;
import org.apache.shiro.web.servlet.ProxiedFilterChain;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import java.util.*;
/**
* Simple {@code NamedFilterList} implementation that is supported by a backing {@link List} instance and a simple
* {@link #getName() name} property. All {@link List} method implementations are immediately delegated to the
* wrapped backing list.
*
* @since 1.0
*/
public class SimpleNamedFilterList implements NamedFilterList {
private String name;
private List&lt;Filter&gt; backingList;
/**
* Creates a new {@code SimpleNamedFilterList} instance with the specified {@code name}, defaulting to a new
* {@link ArrayList ArrayList} instance as the backing list.
*
* @param name the name to assign to this instance.
* @throws IllegalArgumentException if {@code name} is null or empty.
*/
public SimpleNamedFilterList(String name) {
<span class="fc" id="L48"> this(name, new ArrayList&lt;Filter&gt;());</span>
<span class="fc" id="L49"> }</span>
/**
* Creates a new {@code SimpleNamedFilterList} instance with the specified {@code name} and {@code backingList}.
*
* @param name the name to assign to this instance.
* @param backingList the list instance used to back all of this class's {@link List} method implementations.
* @throws IllegalArgumentException if {@code name} is null or empty.
* @throws NullPointerException if the backing list is {@code null}.
*/
<span class="fc" id="L59"> public SimpleNamedFilterList(String name, List&lt;Filter&gt; backingList) {</span>
<span class="fc bfc" id="L60" title="All 2 branches covered."> if (backingList == null) {</span>
<span class="fc" id="L61"> throw new NullPointerException(&quot;backingList constructor argument cannot be null.&quot;);</span>
}
<span class="fc" id="L63"> this.backingList = backingList;</span>
<span class="fc" id="L64"> setName(name);</span>
<span class="fc" id="L65"> }</span>
protected void setName(String name) {
<span class="fc bfc" id="L68" title="All 2 branches covered."> if (!StringUtils.hasText(name)) {</span>
<span class="fc" id="L69"> throw new IllegalArgumentException(&quot;Cannot specify a null or empty name.&quot;);</span>
}
<span class="fc" id="L71"> this.name = name;</span>
<span class="fc" id="L72"> }</span>
public String getName() {
<span class="fc" id="L75"> return name;</span>
}
public FilterChain proxy(FilterChain orig) {
<span class="fc" id="L79"> return new ProxiedFilterChain(orig, this);</span>
}
public boolean add(Filter filter) {
<span class="fc" id="L83"> return this.backingList.add(filter);</span>
}
public void add(int index, Filter filter) {
<span class="fc" id="L87"> this.backingList.add(index, filter);</span>
<span class="fc" id="L88"> }</span>
public boolean addAll(Collection&lt;? extends Filter&gt; c) {
<span class="fc" id="L91"> return this.backingList.addAll(c);</span>
}
public boolean addAll(int index, Collection&lt;? extends Filter&gt; c) {
<span class="fc" id="L95"> return this.backingList.addAll(index, c);</span>
}
public void clear() {
<span class="fc" id="L99"> this.backingList.clear();</span>
<span class="fc" id="L100"> }</span>
public boolean contains(Object o) {
<span class="fc" id="L103"> return this.backingList.contains(o);</span>
}
public boolean containsAll(Collection&lt;?&gt; c) {
<span class="fc" id="L107"> return this.backingList.containsAll(c);</span>
}
public Filter get(int index) {
<span class="fc" id="L111"> return this.backingList.get(index);</span>
}
public int indexOf(Object o) {
<span class="fc" id="L115"> return this.backingList.indexOf(o);</span>
}
public boolean isEmpty() {
<span class="fc" id="L119"> return this.backingList.isEmpty();</span>
}
public Iterator&lt;Filter&gt; iterator() {
<span class="fc" id="L123"> return this.backingList.iterator();</span>
}
public int lastIndexOf(Object o) {
<span class="fc" id="L127"> return this.backingList.lastIndexOf(o);</span>
}
public ListIterator&lt;Filter&gt; listIterator() {
<span class="fc" id="L131"> return this.backingList.listIterator();</span>
}
public ListIterator&lt;Filter&gt; listIterator(int index) {
<span class="fc" id="L135"> return this.backingList.listIterator(index);</span>
}
public Filter remove(int index) {
<span class="fc" id="L139"> return this.backingList.remove(index);</span>
}
public boolean remove(Object o) {
<span class="fc" id="L143"> return this.backingList.remove(o);</span>
}
public boolean removeAll(Collection&lt;?&gt; c) {
<span class="fc" id="L147"> return this.backingList.removeAll(c);</span>
}
public boolean retainAll(Collection&lt;?&gt; c) {
<span class="fc" id="L151"> return this.backingList.retainAll(c);</span>
}
public Filter set(int index, Filter filter) {
<span class="fc" id="L155"> return this.backingList.set(index, filter);</span>
}
public int size() {
<span class="fc" id="L159"> return this.backingList.size();</span>
}
public List&lt;Filter&gt; subList(int fromIndex, int toIndex) {
<span class="fc" id="L163"> return this.backingList.subList(fromIndex, toIndex);</span>
}
public Object[] toArray() {
<span class="fc" id="L167"> return this.backingList.toArray();</span>
}
public &lt;T&gt; T[] toArray(T[] a) {
//noinspection SuspiciousToArrayCall
<span class="fc" id="L172"> return this.backingList.toArray(a);</span>
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.3.201901230119</span></div></body></html>