001    package railo.intergral.fusiondebug.server.type.coll;
002    
003    import railo.intergral.fusiondebug.server.type.FDNodeValueSupport;
004    import railo.intergral.fusiondebug.server.util.FDCaster;
005    import railo.runtime.type.Array;
006    import railo.runtime.type.Collection;
007    import railo.runtime.type.Collection.Key;
008    
009    import com.intergral.fusiondebug.server.FDMutabilityException;
010    import com.intergral.fusiondebug.server.IFDStackFrame;
011    
012    public class FDCollectionNode extends FDNodeValueSupport {
013    
014            private Collection coll;
015            private Key key;
016    
017            /**
018             * Constructor of the class
019             * @param coll
020             * @param key
021             */
022            public FDCollectionNode(IFDStackFrame frame,Collection coll, Key key) {
023                    super(frame);
024                    this.coll=coll;
025                    this.key=key;
026            }
027    
028            @Override
029            public String getName() {
030                    if(coll instanceof Array) return "["+key.getString()+"]";
031                    return key.getString();
032            }
033    
034            @Override
035            protected Object getRawValue() {
036                    return coll.get(key,null);
037            }
038    
039            public boolean isMutable() {
040                    return true;
041            }
042            
043            public void set(String value) throws FDMutabilityException {
044                    coll.setEL(key, FDCaster.unserialize(value));
045            }
046    }