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
    • Constructor Detail

      • ContextMethodBuilder

        public ContextMethodBuilder​(String name,
                                    org.apache.bcel.generic.Type ret,
                                    org.apache.bcel.generic.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 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​(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 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​(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 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​(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​(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 String getFullName()
        Construct fully-qualified class and method name for method under construction.
        Returns:
        fully-qualified class and method name