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        
017    
018        /**
019         * @param pc
020         * @param key
021         * @param value
022         */
023        public DynAssign(Ref key, Ref value) {
024            this.key=key;
025            this.value=value;
026        }
027        
028        
029        @Override
030            public Object getValue(PageContext pc) throws PageException {
031            return pc.setVariable(Caster.toString(key.getValue(pc)),value.getValue(pc));
032        }
033    
034        @Override
035        public String getTypeName() {
036            return "operation";
037        }
038    }