Packages
BSF.CLS

BSF_OnTheFly.cls

rexxcUtil.rex

BSF.CLS Overview

- Routines box box.strictArg bsf.compile bsf.contextClassLoader bsf.createArray bsf.createArrayOf bsf.createJavaArray bsf.createJavaArrayOf bsf.createProxyClass bsf.getConstant bsf.getConstantJSO bsf.getSlotDir bsf.getStaticValue bsf.getStaticValueJSO bsf.getStaticValueStrict bsf.getStaticValueStrictJSO bsf.haltThread bsf.iconv bsf.import bsf.importClass bsf.isA bsf.JSOasUtf8string bsf.loadClass bsf.lookupBean bsf.pollEventText bsf.postEventText bsf.redirectTo bsf.stringToUtf8 BSF.terminateRexxEngine bsf.unregisterBean bsf.utf8stringAsJSO bsf.utf8ToString bsf.version bsf.wrap bsf.wrapStaticFields create_display.version_entry escapeQuotes getAndSetPathToIcons iif initialize.BSF.dir makeBSF4ooRexxLookLikeMacOSX parseJavaOptions pp ppJavaExceptionChain unbox unbox_ori xBSF xBsfCreateRexxProxy xBsfLoadJava xBsfRexxProxy xBsfUninit4JavaBean
- Floating Methods newStrict
- Classes
  - AwtGUIThread
    - Attributes: JavaGuiUtilityClz msgQueue runnable waitingToRun
    - Methods: init invokeOnGuiThread isGuiThread
  - BSF
    - Attributes: bsf.null_string bsf.null_string rBSF rBsfCreateRexxProxy rBsfRexxProxy rBsfUninit4JavaBean rii_id
    - Methods: init bsf.addEventListener bsf.attachNewStrict bsf.createArray bsf.createArrayOf bsf.createJavaArray bsf.createJavaArrayOf bsf.dispatch bsf.exit bsf.exit bsf.FullJavaClassName bsf.getFieldValue bsf.getFieldValueJSO bsf.getFieldValueStrict bsf.getFieldValueStrictJSO bsf.getPropertyValue bsf.getPropertyValueJSO bsf.getStaticValue bsf.getStaticValueJSO bsf.getStaticValueStrict bsf.getStaticValueStrictJSO bsf.haltThread bsf.import bsf.importClass bsf.invoke bsf.invokeJSO bsf.invokeStrict bsf.invokeStrictJSO bsf.isA bsf.loadClass bsf.lookupBean bsf.pollEventText bsf.postEventText bsf.setBSF4RexxInfos bsf.setFieldValue bsf.setFieldValueStrict bsf.setPropertyValue bsf.setPropertyValueStrict bsf.setRexxNullString bsf.sleep bsf.wrap bsf.wrapArray bsf.wrapEnumeration makearray supplier uninit unknown init unknown
  - bsf.dialog
    - Methods: init component dialogBox dlgConstants getMessageType inputBox javaDialogClass messageBox setDefaultComponent unknown init
  - BSF.InputStream
    - Attributes: isReader javaObject prefix
    - Methods: string init charIn chars lineIn
  - BSF.OutputStream
    - Attributes: doFlush endOfLine isWriter javaObject prefix
    - Methods: string init charOut lineOut say
  - BSF4REXX
    - Attributes: bsf.dir bsf.dir
    - Methods: init unknown
  - BSF_ARRAY_PROXY
    - Methods: init dimension items uninit
  - BSF_ARRAY_REFERENCE
    - Methods: init [] []= at dimension items MAKEARRAY put putStrict size SUPPLIER uninit
  - BSF_REFERENCE
    - Methods: init util.setmethod
  - FxGUIThread
    - Attributes: JavaGuiUtilityClz msgQueue runnable waitingToRun
    - Methods: init invokeOnGuiThread isGuiThread
  - JavaStaticFields.Directory
    - Attributes: rBSF
    - Methods: init [] []= AT bUseCache entry JavaClassName JavaClassObject init PUT
  - JSR223
    - Attributes: showDebugs showWarnings
    - Methods: init get getAttribute getAttributes getBindings normalizeName ScriptContext2RexxDir set setAttribute
  - Slot.Argument
- Requires BSF4ooRexx library

# BSF.CLS

#### Routine: box

PARSE ARG type +2, val

#### Routine: box.strictArg

USE ARG oType=.nil, oVal, bPrimitive=.true
PARSE ARG type +2

#### Routine: bsf.compile

Routine that compiles a Java source file and returns the class object.
param: className the fully qualified class name (package plus class name in source)
param: code a mandatory string or array of strings representing the Java or NetRexx source code of a class
param: language optional, defaults to "Java", alternatively can be "NetRexx"
param: import logical, if set to .true (default) will box newClass using bsf.import() allowing ooRexx new to be sent), otherwise the Java class object gets returned as is
return: the compiled Java class object
USE ARG className, code, language="Java", bImport=.true

#### Routine: bsf.contextClassLoader

Routine that interfaces with the Thread's context class loader. If no arguments are given the current Thread's context class loader gets returned. Otherwise the argument may be a string denoting a directory or a file, a java.io.File object, a java.net.URL object or an array of these kinds of values, for which a new java.net.URLClassLoader gets created which will be used to set the Thread's context class loader using the old context class loader as its parent. If a context class loader does not exist yet, the method java.lang.ClassLoader.getSystemClassLoader will be used on Java 1.6/6, 1.7/7 and 1.8/8, otherwise (Java 9 or higher) java.lang.ClassLoader.getPlatformClassLoader which then gets used as the parent of the new java.net.URLClassLoader.
param: urlArg optional, either a list of strings denoting a directory or a file or a URL, a java.net.URL object, alternatively a single array of these kinds of values
return: the Thread's current class loader
USE ARG urlArg=.nil

#### Routine: bsf.createArray

#### Routine: bsf.createArrayOf

#### Routine: bsf.createJavaArray

#### Routine: bsf.createJavaArrayOf

#### Routine: bsf.createProxyClass

This routine will create a new Java class on the fly, which extends the supplied Java class and implements the supplied methodNames. The returned Java class implements all constructors of the base class and for each a version which accepts as its first parameter a `RexxProxy` object which gets the Java method invocations forwarded as ooRexx messages with all supplied Java arguments plus a trailing ooRexx `.Directory` argument containing some useful invocation details.
If the `RexxProxy` object needs to invoke a masked method (a method the extended Java class implements and forwards to the `RexxProxy`) then it merely forwards the invocation to `self`, appending to the method name the string "_forwardToSuper" and supplying all parameters the method mandates.
The extended class possesses the static methods `getDefaultHandler()` and `setDefaultHandler(RexxProxy)`. The defaultHandler is a `RexxProxy` which receives ooRexx messages for every static Java method that gets invoked in the extended class.
The extended class possesses the instance methods `getTargetRexxProxy()` and `setTargetRexxProxy(RexxProxy)`. The DefaultHandler is a `RexxProxy` which receives ooRexx messages for every static Java method that gets invoked in the extended class. It is set with the extended constructors that expect a `RexxProxy` as the first argument. If the class' defaultHandler is not set yet, then the extended constructor's code will set it to the targetRexxProxy automatically.
param: javaClzName the fully qualified Java class name to be extended, either a string or a Java class object. If the argument is a string, then it can be optionally followed by blank-delimited Java interface names that the new class would implement as well and get serviced by the `RexxProxy` handling the Java method invocations. Alternatively this can be an array where each array element is either a string fully qualifying the Java class or a Java class object directly representing the class.
param: newName the optional name of the newly created Java class, if omitted, a synthetic name will be created, containing the string "visitorName_$RexxExtendClass$_someHashcode"
param: methName... optional, where this and all following arguments denote a list of single Java method names or a single argument representing an empty string the asterisk (*) character or a Rexx array (or Java array of type `java.lang.String`) where each element denotes the Java method name the Rexx proxy needs to implement; optionally, each Java method name may be preceded by the Java class name and a blank. Please note: all public/protected abstract methods and constructors will always get proxied!
The following special cases apply for this argument:

- if this argument is `.nil`, then only the public/protected abstract methods and constructors get proxied.
- if this argument is a single empty string, then only the public/protected abstract methods and constructors get proxied.
- if this argument has a single element with the value `"e;*"e;` (asterisk), then all public/protected methods and constructors get proxied.

Please note:

- if this argument is omitted or `.nil` then only the public or protected then all declared public and protected methods of the given class will be proxied; if single empty string `""` is given, then an empty (size of 0) Java String array is created and supplied, causing only the public and protected constructors to be proxied
  Warning: if you proxy the methods `toString`, `equals` and `hashCode` be aware that a wrong implementation on your side may break the program. For that reason these methods are never automatically proxied (if you leave out this argument).
  return: Java class object that is able to delegate its method invocations to a `RexxProxy` object
  since: 2010-04-18, 2014-08-31, 2017-03-09

USE ARG javaClzToProxy, newName=.nil, methName="", ...

#### Routine: bsf.getConstant

PARSE ARG className, fieldName

#### Routine: bsf.getConstantJSO

PARSE ARG className, fieldName

#### Routine: bsf.getSlotDir

USE ARG argArray

#### Routine: bsf.getStaticValue

PARSE ARG className, fieldName

#### Routine: bsf.getStaticValueJSO

PARSE ARG className, fieldName

#### Routine: bsf.getStaticValueStrict

PARSE ARG className, fieldName

#### Routine: bsf.getStaticValueStrictJSO

PARSE ARG className, fieldName

#### Routine: bsf.haltThread

USE ARG tid

#### Routine: bsf.iconv

Routine that recodes a Rexx string in the given fromCp codepage into a Rexx string in the given toCp codepage. The names of the character sets used for encoding are documented e.g. in or . Examples for such names are "Cp850", "Cp1251", "UTF-16".
param: str Rexx string encoded in the fromCp codepage
param: fromCp the character set encoding used for str
param: toCp the character set encoding to be used the recoded Rexx string that gets returned
return: the recoded Rexx string
USE ARG str, fromCp, toCp

#### Routine: bsf.import

USE ARG java_path, name4env=.nil, extendedJavaClz=.nil

#### Routine: bsf.importClass

USE ARG java_path, name4env=.nil, extendedJavaClz=.nil

#### Routine: bsf.isA

USE ARG javaObject, javaClass

#### Routine: bsf.JSOasUtf8string

The received Java String object (JSO) is rendered as an UTF-8 Rexx string, independent of the file.encoding codepage setting.
param: obj the Java String object reference or a Java object which String value is retrieved and worked upon
return: a Rexx UTF-8 encoded string constructed from the Java String object
since: 2014-10-07
USE ARG obj

#### Routine: bsf.loadClass

Loads and returns the supplied Java class.
param: javaClassName fully qualified Java class name to load
param: name4env if supplied, the Java class proxy will be stored under this name in the environment such that it can be easily referred to with an environment symbol (a Rexx symbol that starts with a dot followed by the value of name4env
return: the Java class proxy (an ooRexx class object proxying the Java class object)
USE ARG javaClassName, name4env=.nil

#### Routine: bsf.lookupBean

PARSE ARG beanName

#### Routine: bsf.pollEventText

PARSE ARG timeOut

#### Routine: bsf.postEventText

PARSE ARG eventText, priority

#### Routine: bsf.redirectTo

Routine to allow redirecting ooRexx standard monitors (.input, .output, .error, since ooRexx 4.2 in addition: .debugInput, .traceOutput) to Java input and output streams and resetting to default ooRexx streams, if either first argument is not "J"ava (redirecting to the Java standard files) or if no arguments are given altogether. Each BSF.InputStream and BSF.OutputStream object will get their "prefix" attribute defined to prepend an informative string, such that the user is able to distinguish the Rexx output or Rexx input from Java. The prefix values for the redirected Java streams that are monitored by .input, .output, .error, .debugInput and .traceOutput are "REXXin?>", "REXXout>", "REXXerr>", "REXXdbgIn?>" and "REXXtrc>" respectively. To inhibit the prefix to be output, just fetch the monitored stream objects and set the prefix to .nil. To change the prefix values, just fetch the monitored stream objects and set the prefix to any other string.
param: bRedirectTo optional, "J"ava (default): redirect ooRexx monitors to Java's standard (System) streams; otherwise reset to standard ooRexx streams
param: input optional, stream to redirect .input monitor to
param: output optional, stream to redirect .output monitor to
param: error optional, stream to redirect .error monitor to
param: debugInput optional, stream to redirect .debugInput monitor to (defaults to .input~current)
param: traceOutput optional, stream to redirect .traceOutput monitor to (defaults to .error~current)
USE ARG redirectTo="J", input=.nil, output=.nil, error=.nil, debugInput=.nil, traceOutput=.nil

#### Routine: bsf.stringToUtf8

The received Rexx string is rendered to a Java String object using the 'file.encoding' codepage and then translated to an UTF-8 encoded Rexx string.
param: str the Rexx string encoded according to the 'file.encoding's codepage
return: the equivalent UTF-8-encoded Rexx string
since: 2012-02-11
PARSE ARG str

#### Routine: BSF.terminateRexxEngine

#### Routine: bsf.unregisterBean

PARSE ARG beanName

#### Routine: bsf.utf8stringAsJSO

The received Rexx string consists of UTF-8 characters for which a Java string object gets created and returned, independent of the file.encoding codepage setting.
param: str the Rexx string consisting of UTF-8 characters
return: a reference to the Java String object constructed from the Rexx string
since: 2014-10-07
PARSE ARG str

#### Routine: bsf.utf8ToString

The received Java object's string value is rendered to a Rexx string according to 'file.encoding's codepage.
param: obj the Java String object (JSO) or a Java object which string value is retrieved and worked upon, or an UTF-8 encoded Rexx string
return: a Rexx string encoded according to 'file.encoding's codepage
since: 2012-02-11
USE ARG str

#### Routine: bsf.version

USE ARG kind=""

#### Routine: bsf.wrap

PARSE ARG indicator +3 data, bIncr

#### Routine: bsf.wrapStaticFields

PARSE ARG JavaClassName, bNoCache

#### Routine: create_display.version_entry

Encodes the currently employed versions of ooRexx, BSF.CLS and Java in a single string to ease debugging.
return: a string containing the version information of ooRexx, BSF.CLS and Java in use

#### Routine: escapeQuotes

#### Routine: getAndSetPathToIcons

#### Routine: iif

#### Routine: initialize.BSF.dir

#### Routine: makeBSF4ooRexxLookLikeMacOSX

#### Routine: parseJavaOptions

PARSE ARG options

#### Routine: pp

#### Routine: ppJavaExceptionChain

This routine takes a Rexx condition object, extracts the Java exception object and creates the chain of the Java exceptions such that Rexx programmers can easily learn about it. Each Java exception's object name gets shown together with the its string exception. If the optional second argument is `.true` then the stack trace of the source of the Java exception chain gets returned as well.
param: co Rexx condition object (cf. `condition("object")` in the reference manual)
param: bStackTrace optional, defaults to `.false`; if set to `.true` then the stack trace of the source of the Java exception chain gets returned
return: string containing the Java exception chain or an empty string, if there cannot be a a Java exception object found
since: 2020-08-12
author: Rony G. Flatscher
USE ARG co, bStackTrace=.false

#### Routine: unbox

USE ARG o

#### Routine: unbox_ori

USE ARG o

#### Routine: xBSF

EXTERNAL "LIBRARY BSF4ooRexx BSF "

#### Routine: xBsfCreateRexxProxy

EXTERNAL "LIBRARY BSF4ooRexx BsfCreateRexxProxy "

#### Routine: xBsfLoadJava

EXTERNAL "LIBRARY BSF4ooRexx BsfLoadJava "

#### Routine: xBsfRexxProxy

EXTERNAL "LIBRARY BSF4ooRexx BsfRexxProxy "

#### Routine: xBsfUninit4JavaBean

EXTERNAL "LIBRARY BSF4ooRexx BsfUninit4JavaBean "

#### Floating Method: newStrict

- USE ARG javaClass, args

#### Class: AwtGUIThread

Sub-Class: AbstractGUIThread
This class is meant to help ooRexx programmers to simplify interactions with the awt/swing GUI. If Rexx code is invoked by the GUI maintenance code, that Rexx code will already execute on the GUI thread (called "event dispatch thread" a.k.a. "awt thread") and can successfully interact with the GUI and the elements. However, if Rexx code on a non-GUI-thread wishes to interact with the GUI, this would hang the GUI (single threaded implementations are typical for GUIs). Rather, such an interaction must occur on the GUI thread.

The class methods `awtRunLater` and `awtRunLaterLatest` allow Rexx programmers to send Rexx messages later, when running in the GUI thread.
since: 2018-07-14

#### Attributes

- JavaGuiUtilityClz GETTER CLASS

- msgQueue GETTER CLASS

- runnable GETTER CLASS

- waitingToRun GETTER SETTER CLASS

#### Methods

- init CLASS
  Constructor class method.

- invokeOnGuiThread CLASS
  Will cause the `runnable` (this Rexx class wrapped as a java.lang.Runnable object) to execute later on the GUI thread.

- isGuiThread CLASS
  return: returns `.true`, if running on the GUI thread ("event dispatch thread" a.k.a. "awt Thread"), `.false` else

#### Constants

No Constants

#### Class: BSF

#### Attributes

- bsf.null_string GETTER UNGUARDED CLASS

- bsf.null_string SETTER CLASS

- rBSF GETTER SETTER CLASS

- rBsfCreateRexxProxy GETTER SETTER CLASS

- rBsfRexxProxy GETTER SETTER CLASS

- rBsfUninit4JavaBean GETTER SETTER CLASS

- rii_id GETTER

#### Methods

- init CLASS

- bsf.addEventListener
  USE ARG eventSetName, filter, text

- bsf.attachNewStrict CLASS
  USE ARG java_path

- bsf.createArray CLASS

- bsf.createArrayOf CLASS

- bsf.createJavaArray CLASS

- bsf.createJavaArrayOf CLASS

- bsf.dispatch
  USE ARG methodName

- bsf.exit

- bsf.exit CLASS
  USE ARG exitValue, waitTime

- bsf.FullJavaClassName CLASS

- bsf.getFieldValue
  USE ARG fieldName

- bsf.getFieldValueJSO
  USE ARG fieldName

- bsf.getFieldValueStrict
  USE ARG fieldName

- bsf.getFieldValueStrictJSO
  USE ARG fieldName

- bsf.getPropertyValue
  PARSE ARG propertyName, index

- bsf.getPropertyValueJSO
  PARSE ARG propertyName, index

- bsf.getStaticValue CLASS
  PARSE ARG className, fieldName

- bsf.getStaticValueJSO CLASS
  PARSE ARG className, fieldName

- bsf.getStaticValueStrict CLASS
  PARSE ARG className, fieldName

- bsf.getStaticValueStrictJSO CLASS
  PARSE ARG className, fieldName

- bsf.haltThread CLASS
  USE ARG tid

- bsf.import CLASS
  USE ARG java_path, classname=.nil, extendedJavaClz=.nil

- bsf.importClass CLASS

- bsf.invoke
  PARSE ARG methodName

- bsf.invokeJSO
  USE ARG name

- bsf.invokeStrict
  USE ARG name

- bsf.invokeStrictJSO
  USE ARG name

- bsf.isA
  USE ARG javaClass

- bsf.loadClass CLASS
  USE ARG javaClassName, name4env=.nil

- bsf.lookupBean CLASS
  PARSE ARG beanName

- bsf.pollEventText CLASS
  PARSE ARG timeOut

- bsf.postEventText CLASS
  PARSE ARG eventText, priority

- bsf.setBSF4RexxInfos CLASS

- bsf.setFieldValue
  USE ARG fieldName, newValue

- bsf.setFieldValueStrict
  USE ARG fieldName, x, ...

- bsf.setPropertyValue
  PARSE ARG propertyName, index

- bsf.setPropertyValueStrict
  PARSE ARG propertyName, index

- bsf.setRexxNullString CLASS
  PARSE ARG newValue

- bsf.sleep CLASS
  USE ARG sleepTime

- bsf.wrap UNGUARDED CLASS
  USE ARG obj, bIncr=.false

- bsf.wrapArray UNGUARDED CLASS
  PARSE ARG beanName

- bsf.wrapEnumeration CLASS
  PARSE ARG beanName

- makearray

- supplier

- uninit

- unknown UNGUARDED CLASS

- init
  USE ARG javaClass, args

- unknown UNGUARDED
  USE ARG name, args

#### Constants

No Constants

#### Class: bsf.dialog

#### Attributes

No Attributes

#### Methods

- init CLASS

- component

- dialogBox
  USE ARG message, title, messageType, optionType, icon, textOfButtons, defaultButton

- dlgConstants CLASS

- getMessageType CLASS
  PARSE ARG messageType .

- inputBox
  USE ARG message

- javaDialogClass CLASS

- messageBox
  USE ARG message, title, messageType

- setDefaultComponent CLASS

- unknown CLASS
  USE ARG methodName, arrArgs

- init
  USE ARG component

#### Constants

No Constants

#### Class: BSF.InputStream

Sub-Class: inputStream

#### Attributes

- isReader GETTER SETTER

- javaObject GETTER SETTER

- prefix GETTER SETTER

#### Methods

- string

- init
  USE ARG javaObject, prefix=.nil

- charIn
  USE ARG start=1, length=1

- chars

- lineIn

#### Constants

No Constants

#### Class: BSF.OutputStream

Sub-Class: outputStream

#### Attributes

- doFlush GETTER SETTER

- endOfLine GETTER SETTER

- isWriter GETTER SETTER

- javaObject GETTER SETTER

- prefix GETTER SETTER

#### Methods

- string

- init
  Constructor.
  param: javaObject a Java `Stream` or `Writer` object to use for output
  param: prefix the string to print at the beginning of an output line, defaults to `.nil`
  param: endofLine the string to use as end-of-line sequence, defaults to `.endOfLine`
  USE ARG javaObject, prefix=.nil, endOfLine=.endOfLine, doFlush=.true

- charOut
  USE ARG chars, start=1, bSkipPrefix=.false

- lineOut
  USE ARG chars=""

- say

#### Constants

No Constants

#### Class: BSF4REXX

Serves as a pseudo directory, will always be available as part of the package. Since: 20171223 (removing dependency on .local) - the attribute 'bsf.dir' can be set only once

#### Attributes

- bsf.dir GETTER CLASS

- bsf.dir SETTER CLASS
  USE ARG bsf.dir

#### Methods

- init CLASS

- unknown CLASS

#### Constants

No Constants

#### Class: BSF_ARRAY_PROXY

Sub-Class: BSF_ARRAY_REFERENCE

#### Attributes

No Attributes

#### Methods

- init
  USE ARG beanName, dimension, items

- dimension

- items

- uninit

#### Constants

No Constants

#### Class: BSF_ARRAY_REFERENCE

Sub-Class: BSF

#### Attributes

No Attributes

#### Methods

- init
  USE ARG beanName, dimension, bIncr=.false

- []

- []=

- at
  USE ARG tmpArr

- dimension

- items

- MAKEARRAY

- put
  USE ARG value, tmpArr

- putStrict
  USE ARG type, value, tmpArr

- size

- SUPPLIER

- uninit

#### Constants

No Constants

#### Class: BSF_REFERENCE

Sub-Class: BSF

#### Attributes

No Attributes

#### Methods

- init
  USE ARG beanName, bIncr=.false

- util.setmethod

#### Constants

No Constants

#### Class: FxGUIThread

Sub-Class: AbstractGUIThread
This class is meant to help ooRexx programmers to simplify interactions with the JavaFX GUI. If Rexx code is invoked by the GUI maintenance code, that Rexx code will already execute on the GUI thread (called "JavaFX Applicaton Thread" on JavaFX) and can successfully interact with the GUI and the elements. However, if Rexx code on a non-GUI-thread wishes to interact with the GUI, this would hang the GUI (single threaded implementations are typical for GUIs). Rather, such an interaction must occur on the GUI thread.

The class methods `fxRunLater` and `fxRunLaterLatest` allow Rexx programmers to send Rexx messages later, when running in the GUI thread.
since: 2017-08-05

#### Attributes

- JavaGuiUtilityClz GETTER CLASS

- msgQueue GETTER CLASS

- runnable GETTER CLASS

- waitingToRun GETTER SETTER CLASS

#### Methods

- init CLASS
  Constructor class method.

- invokeOnGuiThread CLASS
  Will cause the `runnable` (this Rexx class wrapped as a java.lang.Runnable object) to execute later on the GUI thread.

- isGuiThread CLASS
  return: returns `.true`, if running on the GUI thread ("JavaFX Application Thread"), `.false` else

#### Constants

No Constants

#### Class: JavaStaticFields.Directory

Sub-Class: directory

#### Attributes

- rBSF GETTER SETTER CLASS

#### Methods

- init CLASS

- []

- []=

- AT
  PARSE ARG fieldName

- bUseCache

- entry
  PARSE ARG index

- JavaClassName

- JavaClassObject

- init
  PARSE ARG JavaClassName, bNoCache

- PUT
  USE ARG newVal, fieldName

#### Constants

No Constants

#### Class: JSR223

A utility class to ease JSR-223 (javax.script) related functionality.

#### Attributes

- showDebugs GETTER SETTER CLASS

- showWarnings GETTER SETTER CLASS

#### Methods

- init CLASS

- get CLASS
  This method will be used by the Rexx injection code in Rexx scripts if the Rexx script annotation `@GET` or `@GET(quoted list of blank delimited attribute names)` is contained in Rexx block comments.
  param: scriptContext a Java `scriptContext` or a RexxContext `.context` object from which the last argument will be fetched (expecting a slotDir argument appended by BSF4ooRexx) which is expected to have the Java `scriptContext` stored with the index named `SCRIPTCONTEXT`.
  param: attributeNames optional.
  - If omitted or blank string will cause all attributes from all Bindings in the `scriptContext` to be made available as local Rexx variables.
  - If the string contains (blank delimited) attribute names then each attribute will be looked up using the ScriptContext's Bindings sorted ascendingly by their scope number. The value of the first found entry will be made available for the matching Rexx variable. If attribute names contain blanks, then they must be enquoted in the Rexx script annotation.
  - If the attribute name is immediately followed by a colon (:) then immediately a scope number must be following. This will restrict the lookup to the ScriptContext's Bindings having that scope number.
  - If the attribute name is a number and that number is not used as an attribute name in any Bindings, then it is taken as the scope number to restrict lookups to for all following attribute names.
  return: a Rexx directory object where the index is a valid Rexx variable name derived from the attribute name [illegal Rexx variable characters get replaced by question marks (?), cf. class method {@link normalizeName}] and the item is the attribute's value
  USE ARG scriptContext, attributeNames=""

- getAttribute CLASS
  Class method that returns the requested attribute from the ScriptContext.
  param: scriptContext the javax.script.ScriptContext
  param: name the attribute's name
  param: scope the scope number for the javax.script.Binding to be retrieved from scriptContext
  return: the attribute's value or `.nil` if not found
  USE ARG scriptContext, name, scope=.nil

- getAttributes CLASS
  Fetches the supplied names from the ScriptContext Bindings and returns them as a Rexx directory where the index names are mangled to allow it to be used as a Rexx variable (hence suitable for `BSFContextVariables()`).
  param: scriptContext the Java `ScriptContext` object containing entries in different bindings or the caller's .context object which is expected to have slotDir as its last argument that contains the ScriptContext to work with (which is the case, if the caller was invoked by Java via the javax.script framework)
  param: name, ... optional list of case-sensitive names serving as entries into the ScriptContext's Bindings. If omitted all found attributes will be queried (searching from lowest to highest Bindings) and returned with their mangled names; optionally the second argument may be an ordered Rexx collection of case-sensitive names to be looked up in the ScriptContext's Bindings.
  return: a Rexx directory where the index is the mangled name of the Bindings entry and its item that Bindings entry's value
  USE ARG scriptContext, ...

- getBindings CLASS
  Class method that returns the requested Binding from the ScriptContext.
  param: scriptContext the javax.script.ScriptContext
  param: sc the scope number for the javax.script.Binding to be retrieved from scriptContext
  return: the javax.script.Binding or `.nil` if not found
  USE ARG scriptContext, sc

- normalizeName CLASS
  Returns the normalized (mangled) name for the supplied name. The returned name consists of characters that are valid for Rexx symbols (invalid characters get replaced by a question mark) only and prepends a question mark of the new name would start with a dot or a digit (Rexx variables must not start with a dot or a digit).
  param: name the name to be normalized such that it can be used as a Rexx variable name
  return: either the unchanged name, if it can be used as a Rexx variable name already, otherwise the normalized (mangled) form
  PARSE ARG name

- ScriptContext2RexxDir CLASS
  Class method that creates and returns a Rexx directory object off the supplied `ScriptContext` which is meant to be used with the external Rexx function `BSFContextVariables()` to set and drop context variables. Dots in the Java supplied variable names get replaced by underscores to inhibit the creation of Rexx stem objects.
  param: scriptContext the Java `ScriptContext` object containing entries in different bindings or the caller's .context object which is expected to have slotDir as its last argument that contains the ScriptContext to work with (which is the case, if the caller was invoked by Java via the javax.script framework)
  param: bMangleName defaults to .true, which makes sure that each key in the Binding is a a valid Rexx variable name, and if not will mangle it accordingly; if .false no mangling will take place
  param: scope... optional, defaults to option `"A[ll]"` (all bindings from highest to lowest), `"G[lobal]"` (global scope, i.e. scope value `200`), `"E[ngine]"` (engine scope, i.e. scope value `100`), the scope number to process, optionally followed by additional scope numbers; the explicit given sequence of scope numbers determines the order in which the bindings get added to the directory (entries in bindings of latter scopes override entries in bindings of previous scopes)
  return: a Rexx directory object containing the name/value mappings matching the ScriptContext; the name are mangled to valid Rexx variable names if bMangleName was .true
  USE ARG scriptContext, bMangleName=.true, scope="AllBindings", ...

- set CLASS
  This method will be used by the Rexx injection code in Rexx scripts if the Rexx script annotation `@SET(quoted list of blank delimited attribute names)` is contained in Rexx block comments.

  If an attribute in the attribute list cannot be found in the ScriptContext's scope, a warning will be given. The attribute name will be normalized and that value will be used to look up the current Rexx value in the Rexx variable Rexx directory passed in as the second argument. If there is no Rexx variable with the normalized name a warning will be issued.
  param: scriptContext a Java `scriptContext` or a RexxContext `.context` object from which the last argument will be fetched (expecting a slotDir argument appended by BSF4ooRexx) which is expected to have the Java `scriptContext` stored with the index named `SCRIPTCONTEXT`.
  param: attributeNames optional.

  - If omitted or blank string will cause all attributes from all Bindings in the `scriptContext` to be updated with the values from `RxVarDir`.
  - If the string contains (blank delimited) attribute names then each attribute will be looked up using the ScriptContext's Bindings sorted ascendingly by their scope number. The value of the first found entry with a normalized name matching a Rexx variable name from `RxVarDir` will cause that attribute to be updated with the Rexx value, if that is different. If attribute names contain blanks, then they must be enquoted in the Rexx script annotation.
  - If the attribute name is immediately followed by a colon (:) then immediately a scope number must be following. This will restrict the lookup to the ScriptContext's Bindings having that scope number. If the attribute's normalized name matches a Rexx variable name from `RxVarDir` then that attribute will be updated with the Rexx value, if that is different.
  - If the attribute name is a number and that number is not used as an attribute name in any Bindings, then it is taken as the scope number to restrict lookups to for all following attribute names.
  param: rxVarDir a Rexx directory containing variable names as index and their values as items. From each attribute name its (maybe mangled) Rexx variable name will be inferred, and the attribute's value in the Bindings updated to the Rexx value, if that value differs in its class or objectname value.
  USE ARG scriptContext, attributeNames="", rxVarDir

- setAttribute CLASS
  Class method that returns the requested Binding from the ScriptContext.
  param: scriptContext the javax.script.ScriptContext
  param: sc the scope number for the javax.script.Binding to be retrieved from scriptContext
  return: the javax.script.Binding or `.nil` if not found
  USE ARG scriptContext, name, value, scope=100

#### Constants

- ENGINE_SCOPE Value: 100

- GLOBAL_SCOPE Value: 200

#### Class: Slot.Argument

Sub-Class: Directory
This class gets instantiated either by native or Java code and contains additional, but optional, entries when sending a message to a Rexx object (a callback from native/Java code to Rexx)

#### Attributes

No Attributes

#### Methods

No Methods

#### Constants

No Constants

## Requires

BSF4ooRexx library