Package org.jibx.binding.classes
Class ContextMethodBuilder
java.lang.Object
org.jibx.binding.classes.BindingMethod
org.jibx.binding.classes.MethodBuilder
org.jibx.binding.classes.ExceptionMethodBuilder
org.jibx.binding.classes.ContextMethodBuilder
- Direct Known Subclasses:
MarshalUnmarshalBuilder
Builder for binding methods with a context and, optionally, a current object.
Tracks the current object reference and the context object reference
positions in the local variables table.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
Variable slot for context reference.private String
Context type as accessed by method.private final boolean
Context type as accessed by method.private int
Variable slot for current object reference.private String
Object type as accessed by method (null
if none).Fields inherited from class org.jibx.binding.classes.MethodBuilder
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, SYNTHETIC_ACCESS_FLAG
-
Constructor Summary
ConstructorsConstructorDescriptionContextMethodBuilder
(String name, String sig, ClassFile cf, int access, int obj, String type, int ctx, String ctype) Constructor from signature.ContextMethodBuilder
(String name, String sig, ClassFile cf, int obj, String type, int ctx, String ctype) Constructor from signature for public, final method.ContextMethodBuilder
(String name, Type ret, Type[] args, ClassFile cf, int access, int obj, String type, int ctx, String ctype) Constructor with types specified. -
Method Summary
Modifier and TypeMethodDescriptionConstruct fully-qualified class and method name for method under construction.boolean
Check if method is static.void
Append instruction to load context to stack.void
loadContext
(String type) Append instruction(s) to load context to stack as specified type.void
Append instruction to load object to stack.void
loadObject
(String type) Append instruction(s) to load object to stack as specified type.void
setObjectSlot
(int slot) Set current object slot.void
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, appendDUP_X1, 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, appendStoreLocal, appendSWAP, appendSWAP1For2, 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
-
Field Details
-
m_objectSlot
private int m_objectSlotVariable slot for current object reference. -
m_objectType
Object type as accessed by method (null
if none). -
m_contextSlot
private int m_contextSlotVariable slot for context reference. -
m_contextType
Context type as accessed by method. -
m_isStatic
private final boolean m_isStaticContext type as accessed by method.
-
-
Constructor Details
-
ContextMethodBuilder
public ContextMethodBuilder(String name, Type ret, Type[] args, ClassFile cf, int access, int obj, String type, int ctx, String ctype) 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 builtret
- method return typeargs
- types of argumentscf
- owning class file informationaccess
- flags for method accessobj
- variable slot for current object (negative value if to be defined later)type
- current object type as defined in method (null
if none)ctx
- variable slot for marshalling/unmarshalling contextctype
- context type as defined in method
-
ContextMethodBuilder
public ContextMethodBuilder(String name, String sig, ClassFile cf, int access, int obj, String type, int ctx, String ctype) Constructor from signature.- Parameters:
name
- method name to be builtsig
- method signaturecf
- owning class file informationaccess
- flags for method accessobj
- variable slot for current object (negative value if to be defined later)type
- current object typectx
- variable slot for marshalling/unmarshalling contextctype
- context type as defined in method
-
ContextMethodBuilder
public ContextMethodBuilder(String name, String sig, ClassFile cf, int obj, String type, int ctx, String ctype) Constructor from signature for public, final method.- Parameters:
name
- method name to be builtsig
- method signaturecf
- owning class file informationobj
- variable slot for current object (negative value if to be defined later)type
- current object typectx
- variable slot for marshalling/unmarshalling contextctype
- context type as defined in method
-
-
Method Details
-
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
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
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
-
getFullName
Construct fully-qualified class and method name for method under construction.- Returns:
- fully-qualified class and method name
-