All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.python.core.PyBeanEvent Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

The newest version!
// Copyright (c) Corporation for National Research Initiatives
package org.python.core;

import java.lang.reflect.Method;

@Untraversable
public class PyBeanEvent extends PyObject {

    public Method addMethod;

    public Class eventClass;

    public String __name__;

    public PyBeanEvent(String name, Class eventClass, Method addMethod) {
        __name__ = name.intern();
        this.addMethod = addMethod;
        this.eventClass = eventClass;
    }

    public PyObject _doget(PyObject container) {
        throw Py.TypeError("write only attribute");
    }

    boolean jdontdel() {
        throw Py.TypeError("can't delete this attribute");
    }

    public boolean _doset(PyObject self, PyObject value) {
        Object jself = Py.tojava(self, addMethod.getDeclaringClass());
        T jvalue = Py.tojava(value, eventClass);
        try {
            addMethod.invoke(jself, jvalue);
        } catch (Exception e) {
            throw Py.JavaError(e);
        }
        return true;
    }

    public String toString() {
        return "";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy