get() public method

public get ( ) : object
return object
Beispiel #1
0
        private static object doTrap(object self, string name, List args, Type type)
        {
            Slot slot = type.slot(name, true);

            if (slot is Method)
            {
                Method m = (Method)slot;
                return(m.m_func.callOn(self, args));
            }
            else
            {
                Field f       = (Field)slot;
                int   argSize = (args == null) ? 0 : args.sz();
                if (argSize == 0)
                {
                    return(FanUtil.box(f.get(self)));
                }

                if (argSize == 1)
                {
                    object val = args.get(0);
                    f.set(self, val);
                    return(FanUtil.box(val));
                }

                throw ArgErr.make("Invalid number of args to get or set field '" + name + "'").val;
            }
        }