01: /*
02: * @(#)getProperty.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 getProperty(propertyName)
16: */
17: public class getProperty extends PnutsFunction {
18:
19: public getProperty() {
20: super ("getProperty");
21: }
22:
23: public boolean defined(int nargs) {
24: return nargs == 1;
25: }
26:
27: protected Object exec(Object[] args, Context context) {
28: if (args.length != 1) {
29: undefined(args, context);
30: return null;
31: }
32: return System.getProperty((String) args[0]);
33: }
34:
35: public String toString() {
36: return "function getProperty(propertyName)";
37: }
38: }
|