Ejemplo n.º 1
0
 protected JObject(JObject other)
 {
     if (other != null) {
         this.native = other.native;
         this.avoidDelete = false;
         // stop the destructor of the object being
         // copied to delete the local reference to the
         // Java object
         other.avoidDelete = true;
     }
 }
Ejemplo n.º 2
0
        public JObjectArray(JObject[] source, JClass clazz)
            : this(source.Length, clazz)
        {
            int l = source.Length;
            for (int i = 0; i < l; i++) {
                JObject o = source[i];
                if (o != null) {
                    SetObjectArrayElement (this.Handle, i, o.Handle);
                }
            }

            // TODO ArrayIndexOutOfBoundsException
            // TODO ArrayStoreException
            JThrowable.CheckAndThrow ();
        }
Ejemplo n.º 3
0
        public bool GetBool(JObject obj)
        {
            bool r;

            if (isStatic) {
                r = GetStaticBooleanField (
                    DeclaringClass.Handle,
                    Handle);
            } else {
                if (obj == null) {
                    throw new NullReferenceException (Name);
                } else {
                    r = GetBooleanField (obj.Handle, Handle);
                }
            }

            JThrowable.CheckAndThrow ();

            return r;
        }
Ejemplo n.º 4
0
 protected Prog(JObject other)
     : base(other)
 {
 }
Ejemplo n.º 5
0
 public JWeak(JObject obj)
     : base(NewWeakGlobalRef (obj.Handle))
 {
 }
Ejemplo n.º 6
0
        public object Invoke(JObject obj, JValue[] args)
        {
            if (sig != null && rType == JMethodReturnType.INVALID) {
                DetermineReturnType ();
            }

            // all arrays are objects
            if (isArray) {
                return CallObject (obj, args);
            }

            // if not an array, call right method based on signature
            switch (rType) {
            case JMethodReturnType.BOOL:
                return CallBoolean (obj, args);
            case JMethodReturnType.BYTE:
                return CallByte (obj, args);
            case JMethodReturnType.CHAR:
                return CallChar (obj, args);
            case JMethodReturnType.SHORT:
                return CallShort (obj, args);
            case JMethodReturnType.INT:
                return CallInt (obj, args);
            case JMethodReturnType.LONG:
                return CallLong (obj, args);
            case JMethodReturnType.FLOAT:
                return CallFloat (obj, args);
            case JMethodReturnType.DOUBLE:
                return CallDouble (obj, args);
            case JMethodReturnType.VOID:
                CallVoid (obj, args);
                return null;
            case JMethodReturnType.OBJECT:
                return CallObject (obj, args);
            default:
                throw new SystemException ("Unreachable reached");
            }
        }
Ejemplo n.º 7
0
 public void CallVoid(JObject obj, params object[] args)
 {
     CallVoid (obj, JValue.Convert (args));
 }
Ejemplo n.º 8
0
 public short CallShort(JObject obj, params object[] args)
 {
     return CallShort (obj, JValue.Convert (args));
 }
Ejemplo n.º 9
0
        public JObject CallObject(JObject obj, JValue[] args)
        {
            IntPtr r;

            if (isStatic) {
                r = CallStaticObjectMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                r = CallObjectMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();

            return new JObject (r);
        }
Ejemplo n.º 10
0
        public long CallLong(JObject obj, JValue[] args)
        {
            long r;

            if (isStatic) {
                r = CallStaticLongMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                r = CallLongMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();

            return r;
        }
Ejemplo n.º 11
0
 public JObjectArray(JObject other)
     : base(other)
 {
 }
Ejemplo n.º 12
0
        public void SetShort(JObject obj, short value)
        {
            if (isStatic) {
                SetStaticShortField (
                    DeclaringClass.Handle,
                    Handle,
                    value);
            } else {
                if (obj == null) {
                    throw new NullReferenceException (Name);
                } else {
                    SetShortField (
                        obj.Handle,
                        Handle,
                        value);
                }
            }

            JThrowable.CheckAndThrow ();
        }
Ejemplo n.º 13
0
        public short GetShort(JObject obj)
        {
            short r;

            if (isStatic) {
                r = GetStaticShortField (
                    DeclaringClass.Handle,
                    Handle);
            } else {
                if (obj == null) {
                    throw new NullReferenceException (Name);
                } else {
                    r = GetShortField (obj.Handle, Handle);
                }
            }

            JThrowable.CheckAndThrow ();

            return r;
        }
Ejemplo n.º 14
0
        public JObject GetObject(JObject obj)
        {
            IntPtr raw;

            if (isStatic) {
                raw = GetStaticObjectField (
                    DeclaringClass.Handle,
                    Handle);
            } else {
                if (obj == null) {
                    throw new NullReferenceException (Name);
                } else {
                    raw = GetObjectField (obj.Handle, Handle);
                }
            }

            return new JObject (raw);
        }
Ejemplo n.º 15
0
        public char GetChar(JObject obj)
        {
            ushort r;

            if (isStatic) {
                r = GetStaticCharField (
                    DeclaringClass.Handle,
                    Handle);
            } else {
                if (obj == null) {
                    throw new NullReferenceException (Name);
                } else {
                    r = GetCharField (obj.Handle, Handle);
                }
            }

            JThrowable.CheckAndThrow ();

            return (char) r;
        }
Ejemplo n.º 16
0
 public float CallFloat(JObject obj, params object[] args)
 {
     return CallFloat (obj, JValue.Convert (args));
 }
Ejemplo n.º 17
0
 public int CallInt(JObject obj, params object[] args)
 {
     return CallInt (obj, JValue.Convert (args));
 }
Ejemplo n.º 18
0
        public bool CallBoolean(JObject obj, JValue[] args)
        {
            bool r;

            if (isStatic) {
                r = CallStaticBooleanMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                r = CallBooleanMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();

            return r;
        }
Ejemplo n.º 19
0
 public long CallLong(JObject obj, params object[] args)
 {
     return CallLong (obj, JValue.Convert (args));
 }
Ejemplo n.º 20
0
 public bool CallBoolean(JObject obj, params object[] args)
 {
     return CallBoolean (obj, JValue.Convert (args));
 }
Ejemplo n.º 21
0
        public short CallShort(JObject obj, JValue[] args)
        {
            short r;

            if (isStatic) {
                r = CallStaticShortMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                r = CallShortMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();

            return r;
        }
Ejemplo n.º 22
0
 public sbyte CallByte(JObject obj, params object[] args)
 {
     return CallByte (obj, JValue.Convert (args));
 }
Ejemplo n.º 23
0
        public void CallVoid(JObject obj, JValue[] args)
        {
            if (isStatic) {
                CallStaticVoidMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                CallVoidMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();
        }
Ejemplo n.º 24
0
        public char CallChar(JObject obj, JValue[] args)
        {
            ushort r;

            if (isStatic) {
                r = CallStaticCharMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                r = CallCharMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();

            return (char) r;
        }
Ejemplo n.º 25
0
 // convenience method
 // not used by generated code since it requires
 // boxing/unboxing on return type (performance)
 public object Invoke(JObject obj, params object[] args)
 {
     return Invoke (obj, JValue.Convert (args));
 }
Ejemplo n.º 26
0
 public char CallChar(JObject obj, params object[] args)
 {
     return CallChar (obj, JValue.Convert (args));
 }
Ejemplo n.º 27
0
 public JString(JObject obj)
     : base(obj.Handle)
 {
 }
Ejemplo n.º 28
0
        public double CallDouble(JObject obj, JValue[] args)
        {
            double r;

            if (isStatic) {
                r = CallStaticDoubleMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                r = CallDoubleMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();

            return r;
        }
Ejemplo n.º 29
0
 public bool IsInstance(JObject obj)
 {
     return IsInstanceOf (obj.Handle, this.Handle);
 }
Ejemplo n.º 30
0
 public double CallDouble(JObject obj, params object[] args)
 {
     return CallDouble (obj, JValue.Convert (args));
 }