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.MethodExpression; 27 import javax.el.MethodInfo; 28 import javax.el.MethodNotFoundException; 29 import javax.el.PropertyNotFoundException; 30 31 public final class JspMethodExpression extends MethodExpression implements 32 Externalizable { 33 34 private String mark; 35 36 private MethodExpression target; 37 38 public JspMethodExpression() { 39 super(); 40 } 41 42 public JspMethodExpression(String mark, MethodExpression target) { 43 this.target = target; 44 this.mark = mark; 45 } 46 47 public MethodInfo getMethodInfo(ELContext context) 48 throws NullPointerException , PropertyNotFoundException, 49 MethodNotFoundException, ELException { 50 try { 51 return this.target.getMethodInfo(context); 52 } catch (MethodNotFoundException e) { 53 if (e instanceof JspMethodNotFoundException) throw e; 54 throw new JspMethodNotFoundException(this.mark, e); 55 } catch (PropertyNotFoundException e) { 56 if (e instanceof JspPropertyNotFoundException) throw e; 57 throw new JspPropertyNotFoundException(this.mark, e); 58 } catch (ELException e) { 59 if (e instanceof JspELException) throw e; 60 throw new JspELException(this.mark, e); 61 } 62 } 63 64 public Object invoke(ELContext context, Object [] params) 65 throws NullPointerException , PropertyNotFoundException, 66 MethodNotFoundException, ELException { 67 try { 68 return this.target.invoke(context, params); 69 } catch (MethodNotFoundException e) { 70 if (e instanceof JspMethodNotFoundException) throw e; 71 throw new JspMethodNotFoundException(this.mark, e); 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 boolean equals(Object obj) { 82 return this.target.equals(obj); 83 } 84 85 public int hashCode() { 86 return this.target.hashCode(); 87 } 88 89 public String getExpressionString() { 90 return this.target.getExpressionString(); 91 } 92 93 public boolean isLiteralText() { 94 return this.target.isLiteralText(); 95 } 96 97 public void writeExternal(ObjectOutput out) throws IOException { 98 out.writeUTF(this.mark); 99 out.writeObject(this.target); 100 } 101 102 public void readExternal(ObjectInput in) throws IOException , 103 ClassNotFoundException { 104 this.mark = in.readUTF(); 105 this.target = (MethodExpression) in.readObject(); 106 } 107 108 } 109 | Popular Tags |