/*
Copyright 1996-2003
Simon Whiteside
*/
package simkin.examples.person;
import simkin.*;
import java.io.StringBufferInputStream;
/**
* This program shows how a Simkin script can access fields and methods within any Java object
*/
public class Person {
/**
* This is a public field - giving the person's name
*/
public String Name="Simon";
/**
* This is a public field - giving the person's age
*/
public int Age=35;
/**
* This is a public method - it can be called from Simkin
*/
public void sayHello(){
Tracer.trace("Hello, my name is Simon Whiteside");
}
static String g_XML="";
/*
* Here's the script that will be executed:
*
*
*/
/**
* Entry point - executes the script
*/
public static void main(String a[]){
try{
// Create an interpreter and a context
Interpreter interp=new Interpreter();
ExecutableContext ctxt=new ExecutableContext(interp);
// create an XMLExecutable object with the xml string
XMLExecutable executable=new XMLExecutable(new StringBufferInputStream(g_XML));
// call the "main" method with the person as an argument
Object args[]={new Person()};
executable.method("main",args,ctxt);
}catch(Exception e){
e.printStackTrace();
}
}
}