org.jibx.binding.classes
Class ExceptionMethodBuilder

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

public class ExceptionMethodBuilder
extends MethodBuilder

Builder for simple methods that may just pass checked exceptions on to caller.

Version:
1.0
Author:
Dennis M. Sosnoski

Field Summary
private  java.util.HashMap m_slotMap
          Map for object to variable assignments.
 
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
ExceptionMethodBuilder(java.lang.String name, java.lang.String sig, ClassFile cf)
          Constructor from signature for public, final method.
ExceptionMethodBuilder(java.lang.String name, java.lang.String sig, ClassFile cf, int access)
          Constructor from signature.
ExceptionMethodBuilder(java.lang.String name, org.apache.bcel.generic.Type ret, org.apache.bcel.generic.Type[] args, ClassFile cf, int access)
          Constructor with types specified.
 
Method Summary
 void defineSlot(java.lang.Object obj, org.apache.bcel.generic.Type type)
          Define local variable slot for object.
 void freeSlot(java.lang.Object obj)
          Free local variable slot for object.
 int getSlot(java.lang.Object obj)
          Check if local variable slot defined for object.
protected  void handleExceptions()
          Process accumulated exceptions.
 
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_slotMap

private java.util.HashMap m_slotMap
Map for object to variable assignments.

Constructor Detail

ExceptionMethodBuilder

public ExceptionMethodBuilder(java.lang.String name,
                              org.apache.bcel.generic.Type ret,
                              org.apache.bcel.generic.Type[] args,
                              ClassFile cf,
                              int access)
                       throws JiBXException
Constructor with types specified.

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
Throws:
JiBXException - on error in initializing method construction

ExceptionMethodBuilder

public ExceptionMethodBuilder(java.lang.String name,
                              java.lang.String sig,
                              ClassFile cf,
                              int access)
                       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
Throws:
JiBXException - on error in initializing method construction

ExceptionMethodBuilder

public ExceptionMethodBuilder(java.lang.String name,
                              java.lang.String sig,
                              ClassFile cf)
                       throws JiBXException
Constructor from signature for public, final method.

Parameters:
name - method name to be built
sig - method signature
cf - owning class file information
Throws:
JiBXException - on error in initializing method construction
Method Detail

defineSlot

public void defineSlot(java.lang.Object obj,
                       org.apache.bcel.generic.Type type)
Define local variable slot for object. The current code in the method must have the initial value for the variable on the stack

Parameters:
obj - owning object of slot

getSlot

public int getSlot(java.lang.Object obj)
Check if local variable slot defined for object.

Parameters:
obj - owning object of slot
Returns:
local variable slot assigned to object, or -1 if none

freeSlot

public void freeSlot(java.lang.Object obj)
Free local variable slot for object. This clears the usage of the slot (if one has been defined for the object) so it can be reused for other purposes.

Parameters:
obj - owning object of slot

handleExceptions

protected void handleExceptions()
                         throws JiBXException
Process accumulated exceptions. Just adds the checked exceptions that may be thrown within the body to the list for this method, passing them on to the caller for handling.

Specified by:
handleExceptions in class MethodBuilder
Throws:
JiBXException - on error in exception handling


Project Web Site