Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.beans.Expression;
import java.beans.Statement;

public class Main {
    public static void main(String[] argv) throws Exception {
        Object o = new MyBean();

        Expression expr = new Expression(o, "getProp3", new Object[0]);
        expr.execute();
        byte[] bytes = (byte[]) expr.getValue();

        Statement stmt = new Statement(o, "setProp3", new Object[] { new byte[] { 0x12, 0x23 } });
        stmt.execute();
    }
}

class MyBean {
    String prop1;

    public String getProp1() {
        return prop1;
    }

    public void setProp1(String s) {
        prop1 = s;
    }

    int prop2;

    public int getProp2() {
        return prop2;
    }

    public void setProp2(int i) {
        prop2 = i;
    }

    byte[] prop3;

    public byte[] getProp3() {
        return prop3;
    }

    public void setProp3(byte[] bytes) {
        prop3 = bytes;
    }
}