public class ClassAdapter
extends java.lang.Object
"_forwardToSuper"
methods to allow ooRexx to forward
proxied Java method invocations to their original target on the Java side.
------------------------ Apache Version 2.0 license ------------------------- Copyright (C) 2010-2019 Rony G. Flatscher Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -----------------------------------------------------------------------------
Modifier and Type | Field and Description |
---|---|
static boolean |
bAddCRC32toGeneratedClassName
Flag that determines whether the generated class name should get the CRC32
value appended, defaults to
true . |
static boolean |
bAddCRC32toNewName
Flag that determines whether the supplied
newName should get the
CRC32 value appended, defaults to true . |
static boolean |
bAddHashToGeneratedClassName
Flag that determines whether the generated class name should get the hash value of
the class object appended, defaults to
false . |
static boolean |
bFileNameWithDateOnly
Controls whether the generated file name's date and time portion
should contain the date portion only, defaults to
false . |
static boolean |
bFileNameWithDateTime
Controls whether the generated file name includes a date and time
portion, defaults to
true . |
static boolean |
bFileNameWithSimpleName
Controls whether the generated file name should be led in with the
extended class' simple name, defaults to
true . |
static boolean |
bSaveToFilesystem
Flag that determines whether the generated program should be stored in the file system.
|
static boolean |
bShowSource |
static boolean |
bTiming |
static java.lang.String |
extensionIndicator
String that gets appended to the generated class name to ease locating such classes, defaults to
"_$RexxExtendClass$_" . |
static java.lang.String |
packageName
Package name that will replace the package name of the extended class, defaults
to
"org.rexxla.bsf.engines.rexx.onTheFly" . |
static java.lang.String |
pathToSaveTo
Path where a generated program should be stored to, defaults to the Java temporary directory
(System.getProperty("java.io.tmpdir")) . |
static java.lang.String |
version
Version information on this class.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
calcCRC32(java.lang.String str)
Calculate the CRC32 value for the supplied string and return an uppercased hex-string.
|
static java.lang.Class |
createProxiedJavaClass(java.lang.Class javaClassToProxy,
java.lang.String strNewClzName,
java.lang.String[] methodNames2proxy,
java.lang.Class[] interfaceClasses)
Creates and returns a proxy class in which Java method invocations get forwarded to
a RexxProxy.
|
static java.lang.String |
formatDateTime()
Creates and formats a
Date object. |
static java.lang.String |
formatDateTime(java.util.Date d)
Formats a
Date object. |
static void |
main(java.lang.String[] args)
Allow using this class from the command line to create an extended Java class and displaying the generated source.
|
public static boolean bTiming
public static boolean bShowSource
public static final java.lang.String version
public static boolean bFileNameWithSimpleName
true
.public static boolean bFileNameWithDateTime
true
.public static boolean bFileNameWithDateOnly
false
.public static boolean bSaveToFilesystem
public static boolean bAddCRC32toNewName
newName
should get the
CRC32 value appended, defaults to true
. The CRC32 value gets calculated
from the string values of the arguments such that the same arguments are expected
to create the same CRC32 value.public static boolean bAddCRC32toGeneratedClassName
true
.public static boolean bAddHashToGeneratedClassName
false
. If name clashes occur
in an application due to having duplicate CRC32 values generated, then setting
this flag to true
should allow for creating unique class names thereafter.public static java.lang.String extensionIndicator
"_$RexxExtendClass$_"
.public static java.lang.String packageName
"org.rexxla.bsf.engines.rexx.onTheFly"
.
If the value is null
, then the package name will not be replaced.
If the value is the empty String (length of 0), then the package of the extended class
will be removed.public static java.lang.String pathToSaveTo
(System.getProperty("java.io.tmpdir"))
.public static void main(java.lang.String[] args) throws org.apache.bsf.BSFException
java java org.rexxla.bsf.engines.rexx.ClassAdapter javax.swing.AbstractAction ronysClass "*"
args
- array of blank delimited Strings in the form of "fullJavaClassName [newClassName [methodToProxy [...]]". If there is
a single method to proxy with a value of "*" (asterisk), then all declared methods will get proxied.org.apache.bsf.BSFException
- if any execution error occurspublic static java.lang.Class createProxiedJavaClass(java.lang.Class javaClassToProxy, java.lang.String strNewClzName, java.lang.String[] methodNames2proxy, java.lang.Class[] interfaceClasses) throws org.apache.bsf.BSFException
javaClassToProxy
- Class object to use for proxyingstrNewClzName
- null
or name for proxy class to createmethodNames2proxy
- an array denoting the protected or public methods to proxy. Please note:
each proxied class will get all public/protected abstract methods and constructors
created (proxied).null
, then only the public/protected abstract methods and
constructors get proxied.
length
field is 0
), then
only the public/protected abstract methods and constructors get proxied.
"*"
(asterisk), then
all public/protected methods and constructors get proxied.
interfaceClasses
- optional, the extended class should in addition implement all abstract
methods of these interface classesorg.apache.bsf.BSFException
- if any execution error occurspublic static java.lang.String formatDateTime()
Date
object. Depending on bFileNameWithDateOnly
the time portion may be left out.Date
object representing the date and time of invocationpublic static java.lang.String formatDateTime(java.util.Date d)
Date
object. Depending on bFileNameWithDateOnly
the time portion may be left out.d
- the Date
object to formatDate
object representingpublic static java.lang.String calcCRC32(java.lang.String str)
str
- the String for which the checksum should get calculated