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
public class ContextMethodBuilder extends ExceptionMethodBuilder
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
Fields Modifier and Type Field Description 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 (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
Constructors Constructor Description 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, Type ret, Type[] args, ClassFile cf, int access, int obj, java.lang.String type, int ctx, java.lang.String ctype)
Constructor with types specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getFullName()
Construct fully-qualified class and method name for method under construction.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, 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 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 (null
if none).
-
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, Type ret, Type[] args, ClassFile cf, int access, int obj, java.lang.String type, int ctx, java.lang.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(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.- 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(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.- 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 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
-
getFullName
public java.lang.String getFullName()
Construct fully-qualified class and method name for method under construction.- Returns:
- fully-qualified class and method name
-
-