Coverage Report - org.apache.myfaces.view.facelets.el.TagValueExpression
 
Classes in this File Line Coverage Branch Coverage Complexity
TagValueExpression
0%
0/44
N/A
2.4
 
 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.view.facelets.el;
 20  
 
 21  
 import java.io.Externalizable;
 22  
 import java.io.IOException;
 23  
 import java.io.ObjectInput;
 24  
 import java.io.ObjectOutput;
 25  
 
 26  
 import javax.el.ELContext;
 27  
 import javax.el.ELException;
 28  
 import javax.el.PropertyNotFoundException;
 29  
 import javax.el.PropertyNotWritableException;
 30  
 import javax.el.ValueExpression;
 31  
 import javax.faces.FacesWrapper;
 32  
 import javax.faces.view.facelets.TagAttribute;
 33  
 
 34  
 /**
 35  
  * 
 36  
  * 
 37  
  * @author Jacob Hookom
 38  
  * @version $Id$
 39  
  */
 40  0
 public class TagValueExpression extends ValueExpression implements Externalizable, FacesWrapper<ValueExpression>
 41  
 {
 42  
 
 43  
     private static final long serialVersionUID = 1L;
 44  
 
 45  
     // orig and attr need to be available in TagValueExpressionUEL
 46  
     ValueExpression orig; 
 47  
     String attr; 
 48  
 
 49  
     public TagValueExpression()
 50  
     {
 51  0
         super();
 52  0
     }
 53  
 
 54  
     public TagValueExpression(TagAttribute attr, ValueExpression orig)
 55  0
     {
 56  0
         this.attr = attr.toString();
 57  0
         this.orig = orig;
 58  0
     }
 59  
 
 60  
     public Class<?> getExpectedType()
 61  
     {
 62  0
         return this.orig.getExpectedType();
 63  
     }
 64  
 
 65  
     public Class<?> getType(ELContext context)
 66  
     {
 67  
         try
 68  
         {
 69  0
             return this.orig.getType(context);
 70  
         }
 71  0
         catch (PropertyNotFoundException pnfe)
 72  
         {
 73  0
             throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
 74  
         }
 75  0
         catch (ELException e)
 76  
         {
 77  0
             throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
 78  
         }
 79  
     }
 80  
 
 81  
     public Object getValue(ELContext context)
 82  
     {
 83  
         try
 84  
         {
 85  0
             return this.orig.getValue(context);
 86  
         }
 87  0
         catch (PropertyNotFoundException pnfe)
 88  
         {
 89  0
             throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
 90  
         }
 91  0
         catch (ELException e)
 92  
         {
 93  0
             throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
 94  
         }
 95  
     }
 96  
 
 97  
     public boolean isReadOnly(ELContext context)
 98  
     {
 99  
         try
 100  
         {
 101  0
             return this.orig.isReadOnly(context);
 102  
         }
 103  0
         catch (PropertyNotFoundException pnfe)
 104  
         {
 105  0
             throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
 106  
         }
 107  0
         catch (ELException e)
 108  
         {
 109  0
             throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
 110  
         }
 111  
     }
 112  
 
 113  
     public void setValue(ELContext context, Object value)
 114  
     {
 115  
         try
 116  
         {
 117  0
             this.orig.setValue(context, value);
 118  
         }
 119  0
         catch (PropertyNotFoundException pnfe)
 120  
         {
 121  0
             throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause());
 122  
         }
 123  0
         catch (PropertyNotWritableException pnwe)
 124  
         {
 125  0
             throw new PropertyNotWritableException(this.attr + ": " + pnwe.getMessage(), pnwe.getCause());
 126  
         }
 127  0
         catch (ELException e)
 128  
         {
 129  0
             throw new ELException(this.attr + ": " + e.getMessage(), e.getCause());
 130  0
         }
 131  0
     }
 132  
     
 133  
     public boolean equals(Object obj)
 134  
     {
 135  0
         return this.orig.equals(obj);
 136  
     }
 137  
 
 138  
     public String getExpressionString()
 139  
     {
 140  0
         return this.orig.getExpressionString();
 141  
     }
 142  
 
 143  
     public int hashCode()
 144  
     {
 145  0
         return this.orig.hashCode();
 146  
     }
 147  
 
 148  
     public boolean isLiteralText()
 149  
     {
 150  0
         return this.orig.isLiteralText();
 151  
     }
 152  
 
 153  
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
 154  
     {
 155  0
         this.orig = (ValueExpression) in.readObject();
 156  0
         this.attr = in.readUTF();
 157  0
     }
 158  
 
 159  
     public void writeExternal(ObjectOutput out) throws IOException
 160  
     {
 161  0
         out.writeObject(this.orig);
 162  0
         out.writeUTF(this.attr);
 163  0
     }
 164  
 
 165  
     public String toString()
 166  
     {
 167  0
         return this.attr + ": " + this.orig;
 168  
     }
 169  
 
 170  
     public ValueExpression getWrapped()
 171  
     {
 172  0
         return orig;
 173  
     }
 174  
 }