001    package railo.runtime.interpreter.ref.var;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.exp.PageException;
005    import railo.runtime.interpreter.ref.Ref;
006    import railo.runtime.interpreter.ref.RefSupport;
007    import railo.runtime.op.Caster;
008    
009    /**
010     * 
011     */
012    public final class DynAssign extends RefSupport implements Ref {
013        
014        private Ref value;
015        private Ref key;
016        private PageContext pc;
017    
018    
019        /**
020         * @param pc
021         * @param key
022         * @param value
023         */
024        public DynAssign(PageContext pc,Ref key, Ref value) {
025            this.pc=pc;
026            this.key=key;
027            this.value=value;
028        }
029        
030        
031        /**
032         * @see railo.runtime.interpreter.ref.Ref#getValue()
033         */
034        public Object getValue() throws PageException {
035            return pc.setVariable(Caster.toString(key.getValue()),value.getValue());
036        }
037    
038        /**
039         * @see railo.runtime.interpreter.ref.Ref#getTypeName()
040         */
041        public String getTypeName() {
042            return "operation";
043        }
044    }