org.jibx.binding.classes
Class ContextMethodBuilder

java.lang.Object
  extended by org.jibx.binding.classes.BindingMethod
      extended by org.jibx.binding.classes.MethodBuilder
          extended by org.jibx.binding.classes.ExceptionMethodBuilder
              extended by org.jibx.binding.classes.ContextMethodBuilder
Direct Known Subclasses:
MarshalUnmarshalBuilder

public class ContextMethodBuilder
extends ExceptionMethodBuilder

Builder for binding methods with a context and current object. Tracks the current object reference and the context object reference positions in the local variables table.

Version:
1.0
Author:
Dennis M. Sosnoski

Field Summary
private  int m_contextSlot
          Variable slot for context reference.
private  java.lang.String m_contextType
          Context type as accessed by method.
private  boolean m_isStatic
          Context type as accessed by method.
private  int m_objectSlot
          Variable slot for current object reference.
private  java.lang.String m_objectType
          Object type as accessed by method.
 
Fields inherited from class org.jibx.binding.classes.MethodBuilder
EMPTY_STRING_ARRAY, EXCEPTION_CONSTRUCTOR_SIGNATURE1, EXCEPTION_CONSTRUCTOR_SIGNATURE2, FRAMEWORK_EXCEPTION_CLASS, m_exceptions, m_generator, m_hashCode, m_instructionBuilder, m_item, m_method, m_targetBranches, m_valueMap, s_argNameLists
 
Constructor Summary
ContextMethodBuilder(java.lang.String name, java.lang.String sig, ClassFile cf, int access, int obj, java.lang.String type, int ctx, java.lang.String ctype)
          Constructor from signature.
ContextMethodBuilder(java.lang.String name, java.lang.String sig, ClassFile cf, int obj, java.lang.String type, int ctx, java.lang.String ctype)
          Constructor from signature for public, final method.
ContextMethodBuilder(java.lang.String name, org.apache.bcel.generic.Type ret, org.apache.bcel.generic.Type[] args, ClassFile cf, int access, int obj, java.lang.String type, int ctx, java.lang.String ctype)
          Constructor with types specified.
 
Method Summary
 boolean isStaticMethod()
          Check if method is static.
 void loadContext()
          Append instruction to load context to stack.
 void loadContext(java.lang.String type)
          Append instruction(s) to load context to stack as specified type.
 void loadObject()
          Append instruction to load object to stack.
 void loadObject(java.lang.String type)
          Append instruction(s) to load object to stack as specified type.
 void setObjectSlot(int slot)
          Set current object slot.
 void storeObject()
          Append instruction to store object from stack.
 
Methods inherited from class org.jibx.binding.classes.ExceptionMethodBuilder
defineSlot, freeSlot, getSlot, handleExceptions
 
Methods inherited from class org.jibx.binding.classes.MethodBuilder
addException, addLocal, addMethod, addMethodExceptions, appendAASTORE, appendACONST_NULL, appendALOAD, appendARRAYLENGTH, appendASTORE, appendCall, appendCallInit, appendCallInterface, appendCallStatic, appendCallVirtual, appendCreateArray, appendCreateCast, appendCreateCast, appendCreateNew, appendDCMPG, appendDUP_X1, appendDUP, appendDUP2, appendFCMPG, appendGet, appendGetField, appendGetStatic, appendIASTORE, appendICONST_0, appendICONST_1, appendIF_ICMPNE, appendIFEQ, appendIFGE, appendIFLT, appendIFNE, appendIFNONNULL, appendIFNULL, appendIncrementLocal, appendInstanceOf, appendISUB, appendIXOR, appendLCMP, appendLoadConstant, appendLoadConstant, appendLoadConstant, appendLoadLocal, appendPOP, appendPOP2, appendPut, appendPutField, appendPutStatic, appendReturn, appendReturn, appendReturn, appendStoreLocal, appendSWAP, appendTargetACONST_NULL, appendTargetCreateNew, appendTargetLoadConstant, appendTargetLoadConstant, appendTargetNOP, appendThrow, appendUnconditionalBranch, codeComplete, createLocal, getAccessFlags, getFirstInstruction, getItem, getKeyValue, getLastInstruction, getMethod, getName, getSignature, hashCode, initStackState, initStackState, initStackState, internalAppendCreateNew, isStackTopLong, setAccessFlags, setKeyValue, setTarget, targetNext, targetNext
 
Methods inherited from class org.jibx.binding.classes.BindingMethod
computeMethodHash, equals, getClassFile, makeAccessible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_objectSlot

private int m_objectSlot
Variable slot for current object reference.


m_objectType

private java.lang.String m_objectType
Object type as accessed by method.


m_contextSlot

private int m_contextSlot
Variable slot for context reference.


m_contextType

private java.lang.String m_contextType
Context type as accessed by method.


m_isStatic

private final boolean m_isStatic
Context type as accessed by method.

Constructor Detail

ContextMethodBuilder

public ContextMethodBuilder(java.lang.String name,
                            org.apache.bcel.generic.Type ret,
                            org.apache.bcel.generic.Type[] args,
                            ClassFile cf,
                            int access,
                            int obj,
                            java.lang.String type,
                            int ctx,
                            java.lang.String ctype)
                     throws JiBXException
Constructor with types specified. This sets up for constructing a binding method that uses a current object and a marshalling or unmarshalling context.

Parameters:
name - method name to be built
ret - method return type
args - types of arguments
cf - owning class file information
access - flags for method access
obj - variable slot for current object (negative value if to be defined later)
type - current object type as defined in method
ctx - variable slot for marshalling/unmarshalling context
ctype - context type as defined in method
Throws:
JiBXException - on error in initializing method construction

ContextMethodBuilder

public ContextMethodBuilder(java.lang.String name,
                            java.lang.String sig,
                            ClassFile cf,
                            int access,
                            int obj,
                            java.lang.String type,
                            int ctx,
                            java.lang.String ctype)
                     throws JiBXException
Constructor from signature.

Parameters:
name - method name to be built
sig - method signature
cf - owning class file information
access - flags for method access
obj - variable slot for current object (negative value if to be defined later)
type - current object type
ctx - variable slot for marshalling/unmarshalling context
ctype - context type as defined in method
Throws:
JiBXException - on error in initializing method construction

ContextMethodBuilder

public ContextMethodBuilder(java.lang.String name,
                            java.lang.String sig,
                            ClassFile cf,
                            int obj,
                            java.lang.String type,
                            int ctx,
                            java.lang.String ctype)
                     throws JiBXException
Constructor from signature for public, final method.

Parameters:
name - method name to be built
sig - method signature
cf - owning class file information
obj - variable slot for current object (negative value if to be defined later)
type - current object type
ctx - variable slot for marshalling/unmarshalling context
ctype - context type as defined in method
Throws:
JiBXException - on error in initializing method construction
Method Detail

setObjectSlot

public void setObjectSlot(int slot)
Set current object slot. Sets the local variable position of the current object, as required when the object is actually created within the method.

Parameters:
slot - local variable slot for current object

loadObject

public void loadObject()
Append instruction to load object to stack.


storeObject

public void storeObject()
Append instruction to store object from stack.


loadObject

public void loadObject(java.lang.String type)
Append instruction(s) to load object to stack as specified type.

Parameters:
type - loaded type expected on stack

loadContext

public void loadContext()
Append instruction to load context to stack.


loadContext

public void loadContext(java.lang.String type)
Append instruction(s) to load context to stack as specified type.

Parameters:
type - loaded type expected on stack

isStaticMethod

public boolean isStaticMethod()
Check if method is static.

Returns:
true if static, false if not


Project Web Site