Coverage Report - org.apache.myfaces.el.convert.ELResolverToPropertyResolver
 
Classes in this File Line Coverage Branch Coverage Complexity
ELResolverToPropertyResolver
0%
0/48
N/A
4.8
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.el.convert;
 20  
 
 21  
 import javax.el.ELContext;
 22  
 import javax.el.ELException;
 23  
 import javax.el.ELResolver;
 24  
 import javax.faces.context.FacesContext;
 25  
 import javax.faces.el.EvaluationException;
 26  
 import javax.faces.el.PropertyNotFoundException;
 27  
 import javax.faces.el.PropertyResolver;
 28  
 
 29  
 /**
 30  
  * 
 31  
  * @author Stan Silvert
 32  
  */
 33  
 public final class ELResolverToPropertyResolver extends PropertyResolver
 34  
 {
 35  
 
 36  
     private final ELResolver elResolver;
 37  
 
 38  
     /**
 39  
      * Creates a new instance of ELResolverToPropertyResolver
 40  
      */
 41  
     public ELResolverToPropertyResolver(final ELResolver elResolver)
 42  0
     {
 43  0
         this.elResolver = elResolver;
 44  0
     }
 45  
 
 46  
     @Override
 47  
     public boolean isReadOnly(final Object base, final int index)
 48  
             throws EvaluationException, PropertyNotFoundException
 49  
     {
 50  
 
 51  
         try
 52  
         {
 53  0
             return elResolver.isReadOnly(elContext(), base, Integer.valueOf(index));
 54  
         }
 55  0
         catch (javax.el.PropertyNotFoundException e)
 56  
         {
 57  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 58  
         }
 59  0
         catch (ELException e)
 60  
         {
 61  0
             throw new EvaluationException(e);
 62  
         }
 63  
 
 64  
     }
 65  
 
 66  
     @Override
 67  
     public boolean isReadOnly(final Object base, final Object property)
 68  
             throws EvaluationException, PropertyNotFoundException
 69  
     {
 70  
 
 71  
         try
 72  
         {
 73  0
             return elResolver.isReadOnly(elContext(), base, property);
 74  
         }
 75  0
         catch (javax.el.PropertyNotFoundException e)
 76  
         {
 77  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 78  
         }
 79  0
         catch (ELException e)
 80  
         {
 81  0
             throw new EvaluationException(e);
 82  
         }
 83  
 
 84  
     }
 85  
 
 86  
     @Override
 87  
     public Object getValue(final Object base, final int index) throws EvaluationException, PropertyNotFoundException
 88  
     {
 89  
 
 90  
         try
 91  
         {
 92  0
             return elResolver.getValue(elContext(), base, Integer.valueOf(index));
 93  
         }
 94  0
         catch (javax.el.PropertyNotFoundException e)
 95  
         {
 96  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 97  
         }
 98  0
         catch (ELException e)
 99  
         {
 100  0
             throw new EvaluationException(e);
 101  
         }
 102  
 
 103  
     }
 104  
 
 105  
     @Override
 106  
     public Object getValue(final Object base, final Object property)
 107  
             throws EvaluationException, PropertyNotFoundException
 108  
     {
 109  
 
 110  
         try
 111  
         {
 112  0
             return elResolver.getValue(elContext(), base, property);
 113  
         }
 114  0
         catch (javax.el.PropertyNotFoundException e)
 115  
         {
 116  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 117  
         }
 118  0
         catch (ELException e)
 119  
         {
 120  0
             throw new EvaluationException(e);
 121  
         }
 122  
     }
 123  
 
 124  
     @Override
 125  
     public Class getType(final Object base, int index) throws EvaluationException, PropertyNotFoundException
 126  
     {
 127  
 
 128  
         try
 129  
         {
 130  0
             return elResolver.getType(elContext(), base, Integer.valueOf(index));
 131  
         }
 132  0
         catch (javax.el.PropertyNotFoundException e)
 133  
         {
 134  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 135  
         }
 136  0
         catch (ELException e)
 137  
         {
 138  0
             throw new EvaluationException(e);
 139  
         }
 140  
     }
 141  
 
 142  
     @Override
 143  
     public Class getType(final Object base, final Object property)
 144  
             throws EvaluationException, PropertyNotFoundException
 145  
     {
 146  
 
 147  
         try
 148  
         {
 149  0
             return elResolver.getType(elContext(), base, property);
 150  
         }
 151  0
         catch (javax.el.PropertyNotFoundException e)
 152  
         {
 153  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 154  
         }
 155  0
         catch (ELException e)
 156  
         {
 157  0
             throw new EvaluationException(e);
 158  
         }
 159  
     }
 160  
 
 161  
     @Override
 162  
     public void setValue(final Object base, final Object property, final Object value)
 163  
             throws EvaluationException, PropertyNotFoundException
 164  
     {
 165  
 
 166  
         try
 167  
         {
 168  0
             elResolver.setValue(elContext(), base, property, value);
 169  
         }
 170  0
         catch (javax.el.PropertyNotFoundException e)
 171  
         {
 172  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 173  
         }
 174  0
         catch (ELException e)
 175  
         {
 176  0
             throw new EvaluationException(e);
 177  0
         }
 178  0
     }
 179  
 
 180  
     @Override
 181  
     public void setValue(final Object base, int index, final Object value)
 182  
             throws EvaluationException, PropertyNotFoundException
 183  
     {
 184  
 
 185  
         try
 186  
         {
 187  0
             elResolver.setValue(elContext(), base, Integer.valueOf(index), value);
 188  
         }
 189  0
         catch (javax.el.PropertyNotFoundException e)
 190  
         {
 191  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 192  
         }
 193  0
         catch (ELException e)
 194  
         {
 195  0
             throw new EvaluationException(e);
 196  0
         }
 197  
 
 198  0
     }
 199  
 
 200  
     private ELContext elContext()
 201  
     {
 202  0
         return FacesContext.getCurrentInstance().getELContext();
 203  
     }
 204  
 
 205  
 }