1 28 29 package org.jibx.binding.classes; 30 31 import org.apache.bcel.generic.InstructionHandle; 32 import org.apache.bcel.generic.ObjectType; 33 import org.apache.bcel.generic.Type; 34 import org.jibx.runtime.JiBXException; 35 36 43 44 public abstract class MarshalUnmarshalBuilder extends ContextMethodBuilder 45 { 46 61 62 protected MarshalUnmarshalBuilder(String name, Type ret, Type[] args, 63 ClassFile mf, int access, int obj, String type, int ctx, String ctype) 64 throws JiBXException { 65 super(name, ret, args, mf, access, obj, type, ctx, ctype); 66 } 67 68 75 76 public abstract InstructionHandle genExceptionHandler() 77 throws JiBXException; 78 79 86 87 protected void handleExceptions() throws JiBXException { 88 int index = m_exceptions.indexOf(FRAMEWORK_EXCEPTION_CLASS); 89 if (index >= 0) { 90 m_generator.addException(FRAMEWORK_EXCEPTION_CLASS); 91 m_exceptions.remove(index); 92 } 93 if (m_exceptions.size() > 0) { 94 InstructionHandle begin = getFirstInstruction(); 95 InstructionHandle end = getLastInstruction(); 96 InstructionHandle handle = genExceptionHandler(); 97 for (int i = 0; i < m_exceptions.size(); i++) { 98 m_generator.addExceptionHandler(begin, end, handle, 99 (ObjectType)ClassItem. 100 typeFromName((String )m_exceptions.get(i))); 101 } 102 } 103 } 104 } | Popular Tags |