コード例 #1
0
        public static object DynamicGetstatic(string name, string sig, RuntimeTypeHandle type, string clazz, [email protected] callerID)
        {
            Profiler.Count("DynamicGetstatic");
            FieldWrapper fw = GetFieldWrapper(null, type, clazz, name, sig, true);

            java.lang.reflect.Field field = (java.lang.reflect.Field)fw.ToField(false);
            object val = field.get(null, callerID);

            if (fw.FieldTypeWrapper.IsPrimitive)
            {
                val = JVM.Unbox(val);
            }
            return(val);
        }
コード例 #2
0
        public static object DynamicGetfield(object obj, string name, string sig, RuntimeTypeHandle type, string clazz, [email protected] callerID)
        {
            Profiler.Count("DynamicGetfield");
            FieldWrapper fw = GetFieldWrapper(ClassLoaderWrapper.GetWrapperFromType(obj.GetType()), type, clazz, name, sig, false);

            java.lang.reflect.Field field = (java.lang.reflect.Field)fw.ToField(false);
            object val = field.get(obj, callerID);

            if (fw.FieldTypeWrapper.IsPrimitive)
            {
                val = JVM.Unbox(val);
            }
            return(val);
        }
コード例 #3
0
        public static void DynamicPutstatic(object val, string name, string sig, RuntimeTypeHandle type, string clazz, [email protected] callerID)
        {
            Profiler.Count("DynamicPutstatic");
            FieldWrapper fw = GetFieldWrapper(null, type, clazz, name, sig, true);

            if (fw.IsFinal)
            {
                throw new java.lang.IllegalAccessError("Field " + fw.DeclaringType.Name + "." + fw.Name + " is final");
            }
            java.lang.reflect.Field field = (java.lang.reflect.Field)fw.ToField(false);
            if (fw.FieldTypeWrapper.IsPrimitive)
            {
                val = JVM.Box(val);
            }
            field.set(null, val, callerID);
        }