org.jibx.binding.classes
Class MarshalUnmarshalBuilder

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
                  extended by org.jibx.binding.classes.MarshalUnmarshalBuilder
Direct Known Subclasses:
MarshalBuilder, UnmarshalBuilder

public abstract class MarshalUnmarshalBuilder
extends ContextMethodBuilder

Builder for marshal and unmarshal methods. Adds exception accumulation with actual handling provided by the subclass.

Version:
1.0
Author:
Dennis M. Sosnoski

Field Summary
 
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
protected MarshalUnmarshalBuilder(java.lang.String name, org.apache.bcel.generic.Type ret, org.apache.bcel.generic.Type[] args, ClassFile mf, int access, int obj, java.lang.String type, int ctx, java.lang.String ctype)
          Constructor.
 
Method Summary
abstract  org.apache.bcel.generic.InstructionHandle genExceptionHandler()
          Add exception handler code.
protected  void handleExceptions()
          Process accumulated exceptions.
 
Methods inherited from class org.jibx.binding.classes.ContextMethodBuilder
isStaticMethod, loadContext, loadContext, loadObject, loadObject, setObjectSlot, storeObject
 
Methods inherited from class org.jibx.binding.classes.ExceptionMethodBuilder
defineSlot, freeSlot, getSlot
 
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
 

Constructor Detail

MarshalUnmarshalBuilder

protected MarshalUnmarshalBuilder(java.lang.String name,
                                  org.apache.bcel.generic.Type ret,
                                  org.apache.bcel.generic.Type[] args,
                                  ClassFile mf,
                                  int access,
                                  int obj,
                                  java.lang.String type,
                                  int ctx,
                                  java.lang.String ctype)
                           throws JiBXException
Constructor. This sets up for constructing the marshal or unmarshal method.

Parameters:
name - method name to be built
ret - method return type
args - types of arguments
mf - method generation class file information
access - flags for method access
obj - variable slot for current object
type - marshalled or unmarshalled class name
ctx - variable slot for marshalling/unmarshalling context
ctype - context type as defined in method
Throws:
JiBXException - on error in initializing method construction
Method Detail

genExceptionHandler

public abstract org.apache.bcel.generic.InstructionHandle genExceptionHandler()
                                                                       throws JiBXException
Add exception handler code. This method must be implemented by each subclass to provide the appropriate handling code.

Returns:
handle for first instruction in handler
Throws:
JiBXException - on error in creating exception handler

handleExceptions

protected void handleExceptions()
                         throws JiBXException
Process accumulated exceptions. Sets up an exception handler framework and then calls the genExceptionHandler() method to build the handler body.

Overrides:
handleExceptions in class ExceptionMethodBuilder
Throws:
JiBXException - on error in exception handling


Project Web Site