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  
     private final ELResolver elResolver;
 36  
     
 37  
     /**
 38  
      * Creates a new instance of ELResolverToPropertyResolver
 39  
      */
 40  0
     public ELResolverToPropertyResolver(final ELResolver elResolver) {
 41  0
         this.elResolver = elResolver;
 42  0
     }
 43  
 
 44  
     public boolean isReadOnly(final Object base, final int index)
 45  
         throws EvaluationException, PropertyNotFoundException {
 46  
         
 47  
         try {
 48  0
             return elResolver.isReadOnly(elContext(), base, Integer.valueOf(index));
 49  0
         } catch (javax.el.PropertyNotFoundException e) {
 50  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 51  0
         } catch (ELException e) {
 52  0
             throw new EvaluationException(e);
 53  
         }
 54  
         
 55  
     }
 56  
     
 57  
     public boolean isReadOnly(final Object base, final Object property)
 58  
         throws EvaluationException, PropertyNotFoundException {
 59  
         
 60  
         try {
 61  0
             return elResolver.isReadOnly(elContext(), base, property);
 62  0
         } catch (javax.el.PropertyNotFoundException e) {
 63  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 64  0
         } catch (ELException e) {
 65  0
             throw new EvaluationException(e);
 66  
         }
 67  
         
 68  
     }
 69  
 
 70  
     public Object getValue(final Object base, final int index)
 71  
         throws EvaluationException, PropertyNotFoundException {
 72  
         
 73  
         try {
 74  0
             return elResolver.getValue(elContext(), base, Integer.valueOf(index));
 75  0
         } catch (javax.el.PropertyNotFoundException e) {
 76  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 77  0
         } catch (ELException e) {
 78  0
             throw new EvaluationException(e);
 79  
         }
 80  
         
 81  
     }
 82  
 
 83  
     public Object getValue(final Object base, final Object property)
 84  
         throws EvaluationException, PropertyNotFoundException {
 85  
         
 86  
         try {
 87  0
             return elResolver.getValue(elContext(), base, property);
 88  0
         } catch (javax.el.PropertyNotFoundException e) {
 89  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 90  0
         } catch (ELException e) {
 91  0
             throw new EvaluationException(e);
 92  
         }
 93  
     }
 94  
     
 95  
     public Class getType(final Object base, int index)
 96  
         throws EvaluationException, PropertyNotFoundException {
 97  
         
 98  
         try {
 99  0
             return elResolver.getType(elContext(), base, Integer.valueOf(index));
 100  0
         } catch (javax.el.PropertyNotFoundException e) {
 101  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 102  0
         } catch (ELException e) {
 103  0
             throw new EvaluationException(e);
 104  
         }
 105  
     }
 106  
     
 107  
     public Class getType(final Object base, final Object property)
 108  
         throws EvaluationException, PropertyNotFoundException {
 109  
         
 110  
         try {
 111  0
             return elResolver.getType(elContext(), base, property);
 112  0
         } catch (javax.el.PropertyNotFoundException e) {
 113  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 114  0
         } catch (ELException e) {
 115  0
             throw new EvaluationException(e);
 116  
         }
 117  
     }
 118  
 
 119  
     public void setValue(final Object base, final Object property, final Object value)
 120  
         throws EvaluationException, PropertyNotFoundException {
 121  
         
 122  
         try {
 123  0
             elResolver.setValue(elContext(), base, property, value);
 124  0
         } catch (javax.el.PropertyNotFoundException e) {
 125  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 126  0
         } catch (ELException e) {
 127  0
             throw new EvaluationException(e);
 128  0
         }
 129  0
     }
 130  
 
 131  
     public void setValue(final Object base, int index, final Object value)
 132  
         throws EvaluationException, PropertyNotFoundException {
 133  
         
 134  
         try {
 135  0
             elResolver.setValue(elContext(), base, Integer.valueOf(index), value);
 136  0
         } catch (javax.el.PropertyNotFoundException e) {
 137  0
             throw new javax.faces.el.PropertyNotFoundException(e);
 138  0
         } catch (ELException e) {
 139  0
             throw new EvaluationException(e);
 140  0
         }
 141  
         
 142  0
     }
 143  
 
 144  
     private ELContext elContext() {
 145  0
         return FacesContext.getCurrentInstance().getELContext();
 146  
     }
 147  
     
 148  
 }