001 package railo.runtime.interpreter.ref.var; 002 003 import railo.runtime.exp.ExpressionException; 004 import railo.runtime.exp.PageException; 005 import railo.runtime.interpreter.ref.Ref; 006 import railo.runtime.interpreter.ref.RefSupport; 007 import railo.runtime.interpreter.ref.Set; 008 009 public final class Assign extends RefSupport implements Ref { 010 011 private Ref value; 012 private Set coll; 013 014 015 public Assign(Ref coll, Ref value) throws ExpressionException { 016 if(!(coll instanceof Set)) 017 throw new ExpressionException("invalid assignment left-hand side ("+coll.getTypeName()+")"); 018 this.coll=(Set) coll; 019 this.value=value; 020 } 021 022 public Assign(Set coll, Ref value) { 023 this.coll=coll; 024 this.value=value; 025 } 026 027 /** 028 * @see railo.runtime.interpreter.ref.Ref#getValue() 029 */ 030 public Object getValue() throws PageException { 031 return coll.setValue(value.getValue()); 032 } 033 034 /** 035 * @see railo.runtime.interpreter.ref.Ref#getTypeName() 036 */ 037 public String getTypeName() { 038 return "operation"; 039 } 040 }