Class PortDescriptor


  • public abstract class PortDescriptor
    extends Object
    A PortDescriptor wraps a Port in a CodeContext. It includes ID, category, order and info, as well as configuring the port on attachment and reset. The underlying port may be configured from the previous iteration or carried across.
    • Constructor Detail

      • PortDescriptor

        protected PortDescriptor​(String id,
                                 PortDescriptor.Category category,
                                 int index)
        Create a PortDescriptor.
        Parameters:
        id - the ID (must be a valid port ID)
        category - the category
        index - the index within the category (used for ordering - must be unique)
    • Method Detail

      • getID

        public final String getID()
        Get the ID.
        Returns:
        id
      • getIndex

        public int getIndex()
        Get the index.
        Returns:
        index
      • attach

        public abstract void attach​(CodeContext<?> context,
                                    Port previous)
        Configure the port for the provided context. The previous port with the same ID is provided - it may be null or of a different type. If the previous port cannot be carried over, then this method must handle disconnecting and/or reconnecting as appropriate.

        Note : any port passed in as previous will not be disposed

        Parameters:
        context - context being attached to
        previous - previous port with the same ID, may be null or different type
      • getPort

        public abstract Port getPort()
        Get the wrapped port. Should only be called when attached - behaviour is otherwise undefined.
        Returns:
        port
      • getInfo

        public abstract PortInfo getInfo()
        Get port info.
        Returns:
        info
      • reset

        public void reset​(boolean full)
        Hook called to reset during attachment / detachment, or execution context state changes. Full reset happens on execution context changes.
        Parameters:
        full - true if execution context state
      • stopping

        @Deprecated
        public void stopping()
        Deprecated.
        Deprecated hook - no op!
      • dispose

        public void dispose()
        Hook called on code context disposal for any port descriptors not carried over.