1 17 package org.apache.jasper.el; 18 19 import java.io.Externalizable ; 20 import java.io.IOException ; 21 import java.io.ObjectInput ; 22 import java.io.ObjectOutput ; 23 24 import javax.el.ELContext; 25 import javax.el.ELException; 26 import javax.el.PropertyNotFoundException; 27 import javax.el.PropertyNotWritableException; 28 import javax.el.ValueExpression; 29 30 35 public final class JspValueExpression extends ValueExpression implements 36 Externalizable { 37 38 private ValueExpression target; 39 40 private String mark; 41 42 public JspValueExpression() { 43 super(); 44 } 45 46 public JspValueExpression(String mark, ValueExpression target) { 47 this.target = target; 48 this.mark = mark; 49 } 50 51 public Class <?> getExpectedType() { 52 return this.target.getExpectedType(); 53 } 54 55 public Class <?> getType(ELContext context) throws NullPointerException , 56 PropertyNotFoundException, ELException { 57 try { 58 return this.target.getType(context); 59 } catch (PropertyNotFoundException e) { 60 if (e instanceof JspPropertyNotFoundException) throw e; 61 throw new JspPropertyNotFoundException(this.mark, e); 62 } catch (ELException e) { 63 if (e instanceof JspELException) throw e; 64 throw new JspELException(this.mark, e); 65 } 66 } 67 68 public boolean isReadOnly(ELContext context) throws NullPointerException , 69 PropertyNotFoundException, ELException { 70 try { 71 return this.target.isReadOnly(context); 72 } catch (PropertyNotFoundException e) { 73 if (e instanceof JspPropertyNotFoundException) throw e; 74 throw new JspPropertyNotFoundException(this.mark, e); 75 } catch (ELException e) { 76 if (e instanceof JspELException) throw e; 77 throw new JspELException(this.mark, e); 78 } 79 } 80 81 public void setValue(ELContext context, Object value) 82 throws NullPointerException , PropertyNotFoundException, 83 PropertyNotWritableException, ELException { 84 try { 85 this.target.setValue(context, value); 86 } catch (PropertyNotWritableException e) { 87 if (e instanceof JspPropertyNotWritableException) throw e; 88 throw new JspPropertyNotWritableException(this.mark, e); 89 } catch (PropertyNotFoundException e) { 90 if (e instanceof JspPropertyNotFoundException) throw e; 91 throw new JspPropertyNotFoundException(this.mark, e); 92 } catch (ELException e) { 93 if (e instanceof JspELException) throw e; 94 throw new JspELException(this.mark, e); 95 } 96 } 97 98 public Object getValue(ELContext context) throws NullPointerException , 99 PropertyNotFoundException, ELException { 100 try { 101 return this.target.getValue(context); 102 } catch (PropertyNotFoundException e) { 103 if (e instanceof JspPropertyNotFoundException) throw e; 104 throw new JspPropertyNotFoundException(this.mark, e); 105 } catch (ELException e) { 106 if (e instanceof JspELException) throw e; 107 throw new JspELException(this.mark, e); 108 } 109 } 110 111 public boolean equals(Object obj) { 112 return this.target.equals(obj); 113 } 114 115 public int hashCode() { 116 return this.target.hashCode(); 117 } 118 119 public String getExpressionString() { 120 return this.target.getExpressionString(); 121 } 122 123 public boolean isLiteralText() { 124 return this.target.isLiteralText(); 125 } 126 127 public void writeExternal(ObjectOutput out) throws IOException { 128 out.writeUTF(this.mark); 129 out.writeObject(this.target); 130 } 131 132 public void readExternal(ObjectInput in) throws IOException , 133 ClassNotFoundException { 134 this.mark = in.readUTF(); 135 this.target = (ValueExpression) in.readObject(); 136 } 137 } 138 | Popular Tags |