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            /**
029             * @see railo.intergral.fusiondebug.server.type.FDValueSupport#getName()
030             */
031            public String getName() {
032                    if(coll instanceof Array) return "["+key.getString()+"]";
033                    return key.getString();
034            }
035    
036            /**
037             * @see railo.intergral.fusiondebug.server.type.FDNodeVariableSupport#getRawValue()
038             */
039            protected Object getRawValue() {
040                    return coll.get(key,null);
041            }
042    
043            public boolean isMutable() {
044                    return true;
045            }
046            
047            public void set(String value) throws FDMutabilityException {
048                    coll.setEL(key, FDCaster.unserialize(value));
049            }
050    }