|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.openide.execution; import java.lang.reflect.InvocationTargetException; import java.util.Collections; import org.openide.filesystems.*; import org.openide.*; import org.openide.util.Lookup; /** * Base class for scripting interpreters. * @author dstrupl */ public abstract class ScriptType extends org.openide.ServiceType { /** generated Serialized Version UID */ private static final long serialVersionUID = 4893207884933024341L; /** * The script type can decide whether it will be able to execute * the given file object. * @param fo a file to test * @return true if the script can operate on this file */ public abstract boolean acceptFileObject(FileObject fo); /** * Evaluate the script given in the form of a Reader. * @param r * @param context * @return whatever is the result of the script. It can be null. */ public abstract Object eval(java.io.Reader r, Context context) throws InvocationTargetException; /** Calls eval(Reader, Context) with getDefaultContext() as * the second argument. */ public final Object eval(java.io.Reader r) throws InvocationTargetException { return eval(r, getDefaultContext()); } /** * Evaluate the script given in the form of a string. * @param script * @param context * @return whatever is the result of the script. It can be null. */ public abstract Object eval(String script, Context context) throws InvocationTargetException; /** Calls eval(String, Context) with getDefaultContext() as * the second argument. */ public final Object eval(String script) throws InvocationTargetException { return eval(script, getDefaultContext()); } /** * Execute the script given in the form of a Reader. * @param r the contents of the script * @param context the context in which to evaluate it * @return whatever is the result of the script. It can be null. */ public abstract void exec(java.io.Reader r, Context context) throws InvocationTargetException; /** Calls exec(Reader, Context) with getDefaultContext() as * the second argument. */ public final void exec(java.io.Reader r) throws InvocationTargetException { exec(r, getDefaultContext()); } /** * Execute the script given in the form of a string. * @param script * @param context * @return whatever is the result of the script. It can be null. */ public abstract void exec(String script, Context context) throws InvocationTargetException; /** Calls exec(String, Context) with getDefaultContext() as * the second argument. */ public final void exec(String script) throws InvocationTargetException { exec(script, getDefaultContext()); } /** * Adds variable with name to the variables known by the script type. * @param name the name for the newly created variable * @param value initial value variable value (can be null). */ public abstract void addVariable(String name, Object value); /** Get all registered script types. * @return enumeration of |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.