⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pyreflectedfield.java

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 JAVA
字号:
// Copyright (c) Corporation for National Research Initiativespackage org.python.core;import java.lang.reflect.Field;import java.lang.reflect.Modifier;public class PyReflectedField extends PyObject {    public Field field;    public static PyClass __class__;    public PyReflectedField(PyClass c) {        super(c);    }    public PyReflectedField(Field field) {        super(__class__);        this.field = field;    }    public PyObject _doget(PyObject self) {        Object iself = null;        if (!Modifier.isStatic(field.getModifiers())) {            if (self == null)                return this;            iself = Py.tojava(self, field.getDeclaringClass());        }        Object value;        try {            value = field.get(iself);        } catch (IllegalAccessException exc) {            throw Py.JavaError(exc);        }        return Py.java2py(value);    }    public boolean _doset(PyObject self, PyObject value) {        Object iself = null;        if (!Modifier.isStatic(field.getModifiers())) {            if (self == null) {                throw Py.AttributeError("set instance variable as static: "+                                        field.toString());            }            iself = Py.tojava(self, field.getDeclaringClass());        }        Object fvalue = Py.tojava(value, field.getType());        try {            field.set(iself, fvalue);        } catch (IllegalAccessException exc) {            throw Py.JavaError(exc);        }        return true;    }    public String toString() {        return "<reflected field "+field.toString()+" "+Py.idstr(this)+">";    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -