1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.script.internal.safe

File SafeListIterator.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
7
7
1
80
41
7
1
1
7
1

Classes

Class Line # Actions
SafeListIterator 32 7 0% 7 14
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.script.internal.safe;
21   
22    import java.lang.reflect.Constructor;
23    import java.util.ListIterator;
24   
25    /**
26    * Provide a public script access to an iterator.
27    *
28    * @param <E> the type of the iterated value
29    * @version $Id: df1f885904448fb18d6774d033db672e20d8b870 $
30    * @since 4.1M1
31    */
 
32    public class SafeListIterator<E> extends SafeIterator<E, ListIterator<E>> implements ListIterator<E>
33    {
34    /**
35    * @param it the wrapped iterator
36    * @param safeProvider the provider of instances safe for public scripts
37    * @param safeConstructor the constructor used to create new safe wrapper for iterator elements
38    */
 
39  0 toggle public SafeListIterator(ListIterator<E> it, ScriptSafeProvider< ? > safeProvider,
40    Constructor< ? extends E> safeConstructor)
41    {
42  0 super(it, safeProvider, safeConstructor);
43    }
44   
 
45  0 toggle @Override
46    public boolean hasPrevious()
47    {
48  0 return getWrapped().hasPrevious();
49    }
50   
 
51  0 toggle @Override
52    public E previous()
53    {
54  0 return safeElement(getWrapped().previous());
55    }
56   
 
57  0 toggle @Override
58    public int nextIndex()
59    {
60  0 return getWrapped().nextIndex();
61    }
62   
 
63  0 toggle @Override
64    public int previousIndex()
65    {
66  0 return getWrapped().previousIndex();
67    }
68   
 
69  0 toggle @Override
70    public void set(E e)
71    {
72  0 throw new UnsupportedOperationException(FORBIDDEN);
73    }
74   
 
75  0 toggle @Override
76    public void add(E e)
77    {
78  0 throw new UnsupportedOperationException(FORBIDDEN);
79    }
80    }