public override object GetRawConstantValue() { if ((JavaField.getModifiers() & java.lang.reflect.Modifier.STATIC) != 0) { var value = JavaField.get(null); switch (value) { case java.lang.Boolean boolBox: return(system.Boolean.Box(boolBox.booleanValue() ? 1 : 0)); case java.lang.Byte byteBox: return(system.SByte.Box(byteBox.byteValue())); case java.lang.Character charBox: return(system.Char.Box(charBox.charValue())); case java.lang.Short shortBox: return(system.Int16.Box(shortBox.shortValue())); case java.lang.Integer intBox: return(system.Int32.Box(intBox.intValue())); case java.lang.Long longBox: return(system.Int64.Box(longBox.longValue())); case java.lang.Float floatBox: return(system.Single.Box(floatBox.floatValue())); case java.lang.Double doubleBox: return(system.Double.Box(doubleBox.doubleValue())); } } throw new System.NotSupportedException(); }
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); }
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); }
public override object GetValue(object obj) => system.RuntimeType.UnboxJavaReturnValue(JavaField.get(obj));