Пример #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;
     }
 }
Пример #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 ();
        }
Пример #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;
        }
Пример #4
0
 protected Prog(JObject other)
     : base(other)
 {
 }
Пример #5
0
 public JWeak(JObject obj)
     : base(NewWeakGlobalRef (obj.Handle))
 {
 }
Пример #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");
            }
        }
Пример #7
0
 public void CallVoid(JObject obj, params object[] args)
 {
     CallVoid (obj, JValue.Convert (args));
 }
Пример #8
0
 public short CallShort(JObject obj, params object[] args)
 {
     return CallShort (obj, JValue.Convert (args));
 }
Пример #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);
        }
Пример #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;
        }
Пример #11
0
 public JObjectArray(JObject other)
     : base(other)
 {
 }
Пример #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 ();
        }
Пример #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;
        }
Пример #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);
        }
Пример #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;
        }
Пример #16
0
 public float CallFloat(JObject obj, params object[] args)
 {
     return CallFloat (obj, JValue.Convert (args));
 }
Пример #17
0
 public int CallInt(JObject obj, params object[] args)
 {
     return CallInt (obj, JValue.Convert (args));
 }
Пример #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;
        }
Пример #19
0
 public long CallLong(JObject obj, params object[] args)
 {
     return CallLong (obj, JValue.Convert (args));
 }
Пример #20
0
 public bool CallBoolean(JObject obj, params object[] args)
 {
     return CallBoolean (obj, JValue.Convert (args));
 }
Пример #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;
        }
Пример #22
0
 public sbyte CallByte(JObject obj, params object[] args)
 {
     return CallByte (obj, JValue.Convert (args));
 }
Пример #23
0
        public void CallVoid(JObject obj, JValue[] args)
        {
            if (isStatic) {
                CallStaticVoidMethod (
                    DeclaringClass.Handle,
                    Handle,
                    args);
            } else {
                CallVoidMethod (
                    obj.Handle,
                    Handle,
                    args);
            }

            JThrowable.CheckAndThrow ();
        }
Пример #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;
        }
Пример #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));
 }
Пример #26
0
 public char CallChar(JObject obj, params object[] args)
 {
     return CallChar (obj, JValue.Convert (args));
 }
Пример #27
0
 public JString(JObject obj)
     : base(obj.Handle)
 {
 }
Пример #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;
        }
Пример #29
0
 public bool IsInstance(JObject obj)
 {
     return IsInstanceOf (obj.Handle, this.Handle);
 }
Пример #30
0
 public double CallDouble(JObject obj, params object[] args)
 {
     return CallDouble (obj, JValue.Convert (args));
 }