|
20120618, rgf | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.asm.ClassAdapter
org.rexxla.bsf.engines.rexx.RexxExtendClass
public class RexxExtendClass
Extends a supplied class and creates proxy methods (dispatching to RexxProxy objects), if the Java methods are defined as abstract or if a list of Java methods to proxy gets supplied in the constructor. All public constructors in the extended class expect a RexxProxy object as the first argument, followed by all the arguments in the defined order, if arguments are defined in the original class.
The extended class supplies the static public methods setDefaultHandler(RexxProxy rp)
and RexxProxy getDefaultHandler()
to set and get the default RexxProxy handler, which
is used for forwarding static methods and when creating instances of the class and superclass constructors
invoke instance methods.
An instance of the extended class has the methods RexxProxy getTargetRexxProxy()
and setTargetRexxProxy(RexxProxy rp)
implemented, which allow to retrieve or set
the RexxProxy object to which method invocations get forwarded to.
If concrete instance methods of a class are generated in the extended class, then a
method named "forwardToSuper"
and one named
"forwardToSuperStrict"
will be created which allow the Rexx programmer
to explicitly invoke masked methods in the super (extended) class.
If concrete static methods of a class are generated in the extended class, then a
method named "forwardToSuperStatic"
and one named
"forwardToSuperStaticStrict"
will be created which allow the Rexx programmer
to explicitly invoke masked methods in the super (extended) class.
------------------------ Apache Version 2.0 license ------------------------- Copyright (C) 2009 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. -----------------------------------------------------------------------------
Field Summary | |
---|---|
(package private) static int[] |
arr_ICONST
|
protected static boolean |
bDebugClassVisitor
|
protected static boolean |
bDebugMethodVisitor
|
protected org.objectweb.asm.ClassVisitor |
cv
The ClassVisitor to which this adapter delegates calls. |
(package private) static java.lang.String |
FORWARD_TO_SUPER_APPEND_STRING
|
(package private) static java.util.HashSet |
primitiveTypes
|
(package private) static java.lang.String |
rexxExceptionName
|
(package private) static java.lang.String |
rexxProxyName
|
(package private) static java.lang.String |
thisPgmName
|
(package private) TransformationData |
tranData
|
(package private) static java.util.HashMap |
type2getPrimitiveValue
|
(package private) static java.util.HashMap |
type2initDesc
|
(package private) static java.util.HashMap |
type2syntheticWrapperFields
|
(package private) static java.util.HashMap |
type2valueOfDesc
|
(package private) static java.util.HashMap |
type2wrapperClass
|
Fields inherited from interface org.objectweb.asm.Opcodes |
---|
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEDYNAMIC_OWNER, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7 |
Constructor Summary | |
---|---|
RexxExtendClass(org.objectweb.asm.ClassVisitor cv)
Constructs a new ClassAdapter object. |
|
RexxExtendClass(org.objectweb.asm.ClassVisitor cv,
java.lang.String newClassName,
int newClassVersion)
Constructs a new ClassAdapter object. |
|
RexxExtendClass(org.objectweb.asm.ClassVisitor cv,
java.lang.String newClassName,
int newClassVersion,
java.lang.String[] methodNamesToAdd)
Constructs a new ClassAdapter object. |
Method Summary | |
---|---|
static java.lang.String |
getMethodAccessAsString(int access)
|
(package private) static java.lang.String |
getPlainMethodSignature(TransformationData td)
Create and return a string with the method's "desc" delimited with
" | " and followed by the method's signature as one would
have to give it in a Java program. |
(package private) static java.lang.String |
getPlainValueSignature(org.objectweb.asm.Type t)
Turn a desc type into the plain Java style; arrays like "[Z" or "[[java.lang.String" into "boolean []" resp. |
TransformationData |
getTranData()
|
(package private) static java.lang.String |
pp(java.lang.Object o)
|
void |
visit(int version,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String superName,
java.lang.String[] interfaces)
|
org.objectweb.asm.AnnotationVisitor |
visitAnnotation(java.lang.String desc,
boolean visible)
|
void |
visitAttribute(org.objectweb.asm.Attribute attr)
|
void |
visitEnd()
|
org.objectweb.asm.FieldVisitor |
visitField(int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.Object value)
|
void |
visitInnerClass(java.lang.String name,
java.lang.String outerName,
java.lang.String innerName,
int access)
|
org.objectweb.asm.MethodVisitor |
visitMethod(int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
|
void |
visitOuterClass(java.lang.String owner,
java.lang.String name,
java.lang.String desc)
|
void |
visitSource(java.lang.String source,
java.lang.String debug)
|
(package private) void |
workAddClinitMethod(org.objectweb.asm.ClassVisitor cv)
Create class initializer method. |
(package private) void |
workAddFields(org.objectweb.asm.ClassVisitor cv)
Create instance and static fields we need. |
(package private) void |
workAddMethods(org.objectweb.asm.ClassVisitor cv)
Create instance and static fields we need. |
(package private) void |
workConstructor(org.objectweb.asm.MethodVisitor mv)
Creates the bytecode for processing arguments. |
(package private) void |
workProcessArgsAndInvoke(org.objectweb.asm.MethodVisitor mv)
Creates the bytecode for processing arguments. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.objectweb.asm.ClassVisitor cv
ClassVisitor
to which this adapter delegates calls.
protected static final boolean bDebugClassVisitor
protected static final boolean bDebugMethodVisitor
static final java.lang.String thisPgmName
static final java.lang.String rexxExceptionName
static final java.lang.String rexxProxyName
static final java.lang.String FORWARD_TO_SUPER_APPEND_STRING
static final java.util.HashMap type2wrapperClass
static final java.util.HashMap type2valueOfDesc
static final java.util.HashMap type2initDesc
static final java.util.HashMap type2getPrimitiveValue
static final java.util.HashMap type2syntheticWrapperFields
static final java.util.HashSet primitiveTypes
static final int[] arr_ICONST
TransformationData tranData
Constructor Detail |
---|
public RexxExtendClass(org.objectweb.asm.ClassVisitor cv)
ClassAdapter
object. This mode of operation will
only implement abstract methods which will be executed by the RexxProxy.
cv
- the class visitor to which this adapter must delegate calls.public RexxExtendClass(org.objectweb.asm.ClassVisitor cv, java.lang.String newClassName, int newClassVersion)
ClassAdapter
object. This mode of operation will
implement public abstract methods which will be executed by the RexxProxy. In addition
it creates proxy methods for each Java method that carries a name as supplied
in the methodNamesToAdd
array.
This constructor will only create proxy methods for public abstract methods.
cv
- the class visitor to which this adapter must delegate calls.newClassName
- determines new name of the class, if null, an attempt to create
a unique name is undertakennewClassVersion
- if >0 overrides the source class' versionpublic RexxExtendClass(org.objectweb.asm.ClassVisitor cv, java.lang.String newClassName, int newClassVersion, java.lang.String[] methodNamesToAdd)
ClassAdapter
object. This mode of operation will
implement public abstract methods which will be executed by the RexxProxy. In addition
it creates proxy methods for each Java method that carries a name as supplied
in the methodNamesToAdd
array. If the methodNamesToAdd
array
is null
or empty, then all public methods will have a proxy method created for.
cv
- the class visitor to which this adapter must delegate calls.newClassName
- determines new name of the class, if null, an attempt to create
a unique name is undertakennewClassVersion
- if >0 overrides the source class' versionmethodNamesToAdd
- a String array containing (caseless) method names for
which proxy methods should be created; if callbacks to the RexxProxy are desired
from constructors, then they need to be added to this String array under the name
"Method Detail |
---|
public TransformationData getTranData()
public void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
visit
in interface org.objectweb.asm.ClassVisitor
visit
in class org.objectweb.asm.ClassAdapter
public void visitSource(java.lang.String source, java.lang.String debug)
visitSource
in interface org.objectweb.asm.ClassVisitor
visitSource
in class org.objectweb.asm.ClassAdapter
public void visitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String desc)
visitOuterClass
in interface org.objectweb.asm.ClassVisitor
visitOuterClass
in class org.objectweb.asm.ClassAdapter
public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String desc, boolean visible)
visitAnnotation
in interface org.objectweb.asm.ClassVisitor
visitAnnotation
in class org.objectweb.asm.ClassAdapter
public void visitAttribute(org.objectweb.asm.Attribute attr)
visitAttribute
in interface org.objectweb.asm.ClassVisitor
visitAttribute
in class org.objectweb.asm.ClassAdapter
public void visitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int access)
visitInnerClass
in interface org.objectweb.asm.ClassVisitor
visitInnerClass
in class org.objectweb.asm.ClassAdapter
public org.objectweb.asm.FieldVisitor visitField(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.Object value)
visitField
in interface org.objectweb.asm.ClassVisitor
visitField
in class org.objectweb.asm.ClassAdapter
public org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
visitMethod
in interface org.objectweb.asm.ClassVisitor
visitMethod
in class org.objectweb.asm.ClassAdapter
public void visitEnd()
visitEnd
in interface org.objectweb.asm.ClassVisitor
visitEnd
in class org.objectweb.asm.ClassAdapter
void workConstructor(org.objectweb.asm.MethodVisitor mv)
void workProcessArgsAndInvoke(org.objectweb.asm.MethodVisitor mv)
mv
- MethodVisitor object to interact withvoid workAddFields(org.objectweb.asm.ClassVisitor cv)
void workAddMethods(org.objectweb.asm.ClassVisitor cv)
void workAddClinitMethod(org.objectweb.asm.ClassVisitor cv)
public static java.lang.String getMethodAccessAsString(int access)
static java.lang.String getPlainMethodSignature(TransformationData td)
"desc"
delimited with
" | "
and followed by the method's signature as one would
have to give it in a Java program.
static java.lang.String getPlainValueSignature(org.objectweb.asm.Type t)
static java.lang.String pp(java.lang.Object o)
|
20120618, rgf | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |