01: /*
02: * @(#)setProperty.java 1.2 04/12/06
03: *
04: * Copyright (c) 2001-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.util;
10:
11: import pnuts.lang.PnutsFunction;
12: import pnuts.lang.Context;
13:
14: /*
15: * function setProperty(propertyName, value)
16: */
17: public class setProperty extends PnutsFunction {
18:
19: public setProperty() {
20: super ("setProperty");
21: }
22:
23: public boolean defined(int nargs) {
24: return nargs == 2;
25: }
26:
27: protected Object exec(Object[] args, Context context) {
28: if (args.length != 2) {
29: undefined(args, context);
30: return null;
31: }
32: return System.setProperty((String) args[0], (String) args[1]);
33: }
34:
35: public String toString() {
36: return "function setProperty(propertyName, value)";
37: }
38: }
|