| java.lang.Object org.jboss.mx.capability.OptimizedMBeanDispatcher
Method Summary | |
protected static InstructionList | convertObjectToPrimitive(ConstantPoolGen cp, String type) Converts a reference of a primitve wrapper object into a primite value type.
This method assumes that the wrapper object reference is already loaded at the
top of the operand stack. | protected static InstructionList | convertPrimitiveToObject(ConstantPoolGen cp, String type) Converts a primitive into its corresponding object wrapper reference.
This method assumes the primitve is already pushed to the top of the operand
stack. | public static ReflectedMBeanDispatcher | create(MBeanInfo info, Object resource) | protected static MethodGen | createConstructor(ConstantPoolGen cp, String className) | protected static MethodGen | createInvoke(ConstantPoolGen cp, MBeanInfo info, String className, String resourceClassName) Creates the implementation of the invoke(String actionName, Object[] args, String[] signature)
method. | public static String | getDescriptorForType(String name) Returns a descriptor for a given Java type. | public static String | getMethodDescriptor(MBeanParameterInfo[] signature, String returnType) Returns the signature of a MBean operation using the grammar required by
the class file format, excluding the method name. | protected static MethodEntry[] | getOperations(MBeanInfo info) Returns a subset of MBean's operations. | public static boolean | isPrimitive(String name) Checks if a given name matches the TYPE name of a primitive wrapper class. |
convertObjectToPrimitive | protected static InstructionList convertObjectToPrimitive(ConstantPoolGen cp, String type)(Code) | | Converts a reference of a primitve wrapper object into a primite value type.
This method assumes that the wrapper object reference is already loaded at the
top of the operand stack. The stack is modified so that the object reference
to a primitive wrapper is replaced by the corresponding value in the stack.
Parameters: cp - constant pool Parameters: type - class name of the primitive wrapper object to convert an instruction list that replaces an object reference of a primitivewrapper object to its corresponding value in the operand stack |
convertPrimitiveToObject | protected static InstructionList convertPrimitiveToObject(ConstantPoolGen cp, String type)(Code) | | Converts a primitive into its corresponding object wrapper reference.
This method assumes the primitve is already pushed to the top of the operand
stack. The stack is modified so that the primitive value is replaced
by a reference to its corresponding wrapper object that has been
initialized to contain the same value.
Parameters: cp - constant pool Parameters: type - type string of the primitive, for example java.lang.Integer.TYPE Integer.TYPE.getName() an instruction list that replaces the primitive type at the top ofthe operand stack with its corresponding, initialized, wrapper object |
createConstructor | protected static MethodGen createConstructor(ConstantPoolGen cp, String className)(Code) | | creates constructor <init>(MBeanInfo info, AttributeOperationResolver resolver, Object resource)
that calls super(info, resolver, resource) in its implementation
Parameters: cp - constant pool Parameters: className - name of the class being generated |
createInvoke | protected static MethodGen createInvoke(ConstantPoolGen cp, MBeanInfo info, String className, String resourceClassName)(Code) | | Creates the implementation of the invoke(String actionName, Object[] args, String[] signature)
method. This implementation currently handles all non overloaded MBean operation invocations.
Overloaded operations still fall back to the default reflected invocations.
The Java equivalent of the implementation looks roughly as follows:
public void invoke(String actionName, Object[] args, String[] signature)
{
if (actionName != null)
{
try
{
if (actionName.equals(<operName1>))
return ((<resource type>)super.getResourceObject()).<operName1>((<arg1 type>)arg1, (<arg2 type>)arg2, ...);
else if (actionName.equals(<operName2>))
return ((<resource type>)super.getResourceObject()).<operName2>((<arg1 type>)arg1, (<arg2 type>)arg2, ...);
...
else
super.invoke(actionName, args, signature);
}
catch (Throwable t)
{
super.invoke(actionName, args, signature);
}
}
}
Parameters: cp - constant pool of the class being generated Parameters: info - metadata of the MBean Parameters: className - name of the class being generated Parameters: resourceClassName - name of the resource class being invoked |
getDescriptorForType | public static String getDescriptorForType(String name)(Code) | | Returns a descriptor for a given Java type. See
java.lang.Class.getName Class.getName() for details on the grammar for arrays and primitive types. Note that the internal form of the fully
qualified name for class Object is used, so for example, the returned descriptor for
java.lang.Object is
Ljava/lang/Object;
See JVM spec �4.2 and �4.3 for detailed description of the internal class name format and grammar notation.
Parameters: name - fully qualified name of the Java type descriptor string using the JVM grammar |
getMethodDescriptor | public static String getMethodDescriptor(MBeanParameterInfo[] signature, String returnType)(Code) | | Returns the signature of a MBean operation using the grammar required by
the class file format, excluding the method name.
The Java Virtual Machine Specification: 4.3.3 Method Descriptors
A method descriptor represents the parameters that the method takes and the value that it returns:
MethodDescriptor:
( ParameterDescriptor* ) ReturnDescriptor
A parameter descriptor represents a parameter passed to a method:
ParameterDescriptor:
FieldType
A return descriptor represents the type of the value returned from a method. It is a series of characters generated by the grammar:
ReturnDescriptor:
FieldType
V
The character V indicates that the method returns no value (its return type is void).
For example, the method descriptor for the method
Object mymethod(int i, double d, Thread t)
is
(IDLjava/lang/Thread;)Ljava/lang/Object;
Note that internal forms of the fully qualified names of Thread and Object are used in the method descriptor.
|
getOperations | protected static MethodEntry[] getOperations(MBeanInfo info)(Code) | | Returns a subset of MBean's operations. Overloaded operations are not supported yet,
so they're left out of the list and their invocations are delegated to the reflection
based super class.
Overloaded operations that differ in their arg list length may be able to gain in
performance if implemented directly with byte code. Overloaded operations with
equal arg list length may not show much difference compared to ternary search tree
based resolver.
|
isPrimitive | public static boolean isPrimitive(String name)(Code) | | Checks if a given name matches the TYPE name of a primitive wrapper class.
See Also: java.lang.Integer.TYPE Parameters: name - TYPE.getName() true if is a primitive type name; false otherwise |
|
|