站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.0

ScriptType (NetBeans Execution API) - NetBeans API Javadoc 5.5.0

org.openide.execution 1.8.22

org.openide.execution
Class ScriptType

java.lang.Object
  extended by org.openide.ServiceType
      extended by org.openide.execution.ScriptType
All Implemented Interfaces:
Serializable, HelpCtx.Provider

public abstract class ScriptType
extends ServiceType

Base class for scripting interpreters.

See Also:
Serialized Form

Nested Class Summary
static class ScriptType.Context
          Scripting context.
 
Nested classes/interfaces inherited from class org.openide.ServiceType
ServiceType.Handle, ServiceType.Registry
 
Field Summary
 
Fields inherited from class org.openide.ServiceType
PROP_NAME
 
Constructor Summary
ScriptType()
           
 
Method Summary
abstract  boolean acceptFileObject(FileObject fo)
          The script type can decide whether it will be able to execute the given file object.
abstract  void addVariable(String name, Object value)
          Adds variable with name to the variables known by the script type.
 Object eval(Reader r)
          Calls eval(Reader, Context) with getDefaultContext() as the second argument.
abstract  Object eval(Reader r, ScriptType.Context context)
          Evaluate the script given in the form of a Reader.
 Object eval(String script)
          Calls eval(String, Context) with getDefaultContext() as the second argument.
abstract  Object eval(String script, ScriptType.Context context)
          Evaluate the script given in the form of a string.
 void exec(Reader r)
          Calls exec(Reader, Context) with getDefaultContext() as the second argument.
abstract  void exec(Reader r, ScriptType.Context context)
          Execute the script given in the form of a Reader.
 void exec(String script)
          Calls exec(String, Context) with getDefaultContext() as the second argument.
abstract  void exec(String script, ScriptType.Context context)
          Execute the script given in the form of a string.
static ScriptType find(Class clazz)
          Deprecated. Please use Lookup instead.
static ScriptType find(String name)
          Find the script type with requested name.
static ScriptType getDefault()
          Deprecated. Probably meaningless, find all available types and filter with acceptFileObject(org.openide.filesystems.FileObject) instead.
static Enumeration scriptTypes()
          Deprecated. Please use Lookup instead.
 
Methods inherited from class org.openide.ServiceType
addPropertyChangeListener, clone, createClone, displayName, firePropertyChange, getHelpCtx, getName, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptType

public ScriptType()
Method Detail

acceptFileObject

public abstract boolean acceptFileObject(FileObject fo)
The script type can decide whether it will be able to execute the given file object.

Parameters:
fo - a file to test
Returns:
true if the script can operate on this file

eval

public abstract Object eval(Reader r,
                            ScriptType.Context context)
                     throws InvocationTargetException
Evaluate the script given in the form of a Reader.

Parameters:
r -
context -
Returns:
whatever is the result of the script. It can be null.
Throws:
InvocationTargetException

eval

public final Object eval(Reader r)
                  throws InvocationTargetException
Calls eval(Reader, Context) with getDefaultContext() as the second argument.

Throws:
InvocationTargetException

eval

public abstract Object eval(String script,
                            ScriptType.Context context)
                     throws InvocationTargetException
Evaluate the script given in the form of a string.

Parameters:
script -
context -
Returns:
whatever is the result of the script. It can be null.
Throws:
InvocationTargetException

eval

public final Object eval(String script)
                  throws InvocationTargetException
Calls eval(String, Context) with getDefaultContext() as the second argument.

Throws:
InvocationTargetException

exec

public abstract void exec(Reader r,
                          ScriptType.Context context)
                   throws InvocationTargetException
Execute the script given in the form of a Reader.

Parameters:
r - the contents of the script
context - the context in which to evaluate it
Throws:
InvocationTargetException

exec

public final void exec(Reader r)
                throws InvocationTargetException
Calls exec(Reader, Context) with getDefaultContext() as the second argument.

Throws:
InvocationTargetException

exec

public abstract void exec(String script,
                          ScriptType.Context context)
                   throws InvocationTargetException
Execute the script given in the form of a string.

Parameters:
script -
context -
Throws:
InvocationTargetException

exec

public final void exec(String script)
                throws InvocationTargetException
Calls exec(String, Context) with getDefaultContext() as the second argument.

Throws:
InvocationTargetException

addVariable

public abstract void addVariable(String name,
                                 Object value)
Adds variable with name to the variables known by the script type.

Parameters:
name - the name for the newly created variable
value - initial value variable value (can be null).

scriptTypes

public static Enumeration scriptTypes()
Deprecated. Please use Lookup instead.

Get all registered script types.

Returns:
enumeration of ScriptTypes

find

public static ScriptType find(Class clazz)
Deprecated. Please use Lookup instead.

Find the script type implemented as a given class.

Parameters:
clazz - the class of the script type looked for
Returns:
the desired script type or null if it does not exist

find

public static ScriptType find(String name)
Find the script type with requested name.

Parameters:
name - (display) name of script type to find
Returns:
the desired script type or null if it does not exist

getDefault

public static ScriptType getDefault()
Deprecated. Probably meaningless, find all available types and filter with acceptFileObject(org.openide.filesystems.FileObject) instead.

Get the default script type.

Returns:
the default script type

org.openide.execution 1.8.22

Built on May 28 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.