- java.lang.Object
-
- org.praxislive.code.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PortDescriptor.Category
-
Constructor Summary
Constructors Modifier Constructor Description protected
PortDescriptor(String id, PortDescriptor.Category category, int index)
Create a PortDescriptor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract void
attach(CodeContext<?> context, Port previous)
Configure the port for the provided context.void
dispose()
Hook called on code context disposal for any port descriptors not carried over.PortDescriptor.Category
getCategory()
Get the category.String
getID()
Get the ID.int
getIndex()
Get the index.abstract PortInfo
getInfo()
Get port info.abstract Port
getPort()
Get the wrapped port.void
reset(boolean full)
Hook called to reset during attachment / detachment, or execution context state changes.void
stopping()
Deprecated.
-
-
-
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 categoryindex
- the index within the category (used for ordering - must be unique)
-
-
Method Detail
-
getID
public final String getID()
Get the ID.- Returns:
- id
-
getCategory
public PortDescriptor.Category getCategory()
Get the category.- Returns:
- category
-
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 toprevious
- 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.
-
-