01: /*
02: * @(#)setBeanProperty.java 1.2 04/12/06
03: *
04: * Copyright (c) 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package org.pnuts.beans;
10:
11: import pnuts.lang.*;
12: import pnuts.lang.Runtime;
13:
14: /*
15: * setBeanProperty(bean, property_name, value)
16: */
17: public class setBeanProperty extends PnutsFunction {
18:
19: public setBeanProperty() {
20: super ("setBeanProperty");
21: }
22:
23: public boolean defined(int narg) {
24: return (narg == 3);
25: }
26:
27: protected Object exec(Object[] args, Context context) {
28: if (args.length != 3) {
29: undefined(args, context);
30: return null;
31: }
32: Object bean = args[0];
33: String property = (String) args[1];
34: Object value = args[2];
35: Runtime.setBeanProperty(context, bean, property, value);
36: return null;
37: }
38:
39: public String toString() {
40: return "function setBeanProperty(bean, property_name, value)";
41: }
42: }
|