use of java.beans.Statement in project SQLWindowing by hbutani.
the class SerializationUtils method addAntlrPersistenceDelegates.
public static void addAntlrPersistenceDelegates(XMLEncoder e) {
e.setPersistenceDelegate(ASTNode.class, new PersistenceDelegate() {
protected Expression instantiate(Object oldInstance, Encoder out) {
return new Expression(oldInstance, oldInstance.getClass(), "new", new Object[] { ((ASTNode) oldInstance).getToken() });
}
});
e.setPersistenceDelegate(CommonTree.class, new PersistenceDelegate() {
protected Expression instantiate(Object oldInstance, Encoder out) {
return new Expression(oldInstance, oldInstance.getClass(), "new", new Object[] { ((CommonTree) oldInstance).getToken() });
}
});
e.setPersistenceDelegate(BaseTree.class, new PersistenceDelegate() {
protected Expression instantiate(Object oldInstance, Encoder out) {
return new Expression(oldInstance, oldInstance.getClass(), "new", new Object[] {});
}
@SuppressWarnings("rawtypes")
protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
BaseTree t = (BaseTree) oldInstance;
for (int i = 0; i < t.getChildCount(); i++) {
out.writeStatement(new Statement(oldInstance, "addChild", new Object[] { t.getChild(i) }));
}
}
});
e.setPersistenceDelegate(CommonToken.class, new PersistenceDelegate() {
protected Expression instantiate(Object oldInstance, Encoder out) {
return new Expression(oldInstance, oldInstance.getClass(), "new", new Object[] { ((CommonToken) oldInstance).getType(), ((CommonToken) oldInstance).getText() });
}
});
}
use of java.beans.Statement in project jdk8u_jdk by JetBrains.
the class Test6788531 method main.
public static void main(String[] args) throws Exception {
new Statement(new Private(), "run", null).execute();
new Statement(new PrivateGeneric(), "run", new Object[] { "generic" }).execute();
}
use of java.beans.Statement in project jdk8u_jdk by JetBrains.
the class Test8005065 method testStatement.
private static void testStatement() {
Object[] array = { new Object() };
Statement statement = new Statement(null, null, array);
test(statement.getArguments());
array[0] = null;
test(statement.getArguments());
statement.getArguments()[0] = null;
test(statement.getArguments());
}
Aggregations