java.lang.Object
org.praxislive.code.Descriptor<T>
- Type Parameters:
T- direct subtype
- Direct Known Subclasses:
ControlDescriptor,PortDescriptor,ReferenceDescriptor
public abstract sealed class Descriptor<T extends Descriptor<T>>
extends Object
permits ReferenceDescriptor<T>, ControlDescriptor<T>, PortDescriptor<T>
Common interface of reference, port and control descriptors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidattach(CodeContext<?> context, T previous) Attach the descriptor to the provided context.voiddispose()Hook called when the descriptor is disposed, when the code context is changing or the component is being removed.final Stringid()Get the descriptor ID.voidonInit()Hook called when the descriptor becomes part of an active code context, or after anything triggers a reset while active.voidonReset()Hook called when the code context becomes inactive, including on context swap, or if anything else triggers a reset while active.voidonStart()Hook called when the code context becomes active due to the execution context state changing.voidonStop()Hook called when the code context becomes inactive due to the execution context state changing.voidwrite(TreeWriter writer) Write properties or annotations as part of serialization of the component.
-
Constructor Details
-
Descriptor
-
-
Method Details
-
id
Get the descriptor ID.- Returns:
- id
-
attach
Attach the descriptor to the provided context. The previous descriptor with the same ID and type is provided, if it exists. The implementation should handle disposal of the previous descriptor if required.The
onInit()hook will be called after attachment if the code context is active, or when the code context becomes active.- Parameters:
context- code contextprevious- previous descriptor or null
-
onInit
public void onInit()Hook called when the descriptor becomes part of an active code context, or after anything triggers a reset while active. The default implementation does nothing. -
onStart
public void onStart()Hook called when the code context becomes active due to the execution context state changing. TheonInit()hook will have been called prior to this hook. The default implementation does nothing. -
onStop
public void onStop()Hook called when the code context becomes inactive due to the execution context state changing. This hook will be called before theonReset()hook. The default implementation does nothing. -
onReset
public void onReset()Hook called when the code context becomes inactive, including on context swap, or if anything else triggers a reset while active. The default implementation does nothing. -
dispose
public void dispose()Hook called when the descriptor is disposed, when the code context is changing or the component is being removed. This hook is not called by default when a descriptor is passed in as the previous instance inattach(org.praxislive.code.CodeContext, org.praxislive.code.Descriptor). The default implementation does nothing. -
write
Write properties or annotations as part of serialization of the component. The default implementation does nothing.- Parameters:
writer- component tree writer
-