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