Class 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 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 built
        ret - method return type
        args - types of arguments
        cf - owning class file information
        access - flags for method access
        obj - 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 context
        ctype - 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 built
        sig - method signature
        cf - owning class file information
        access - flags for method access
        obj - variable slot for current object (negative value if to be defined later)
        type - current object type
        ctx - variable slot for marshalling/unmarshalling context
        ctype - 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 built
        sig - method signature
        cf - owning class file information
        obj - variable slot for current object (negative value if to be defined later)
        type - current object type
        ctx - variable slot for marshalling/unmarshalling context
        ctype - 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