Class CodeRootContainer<D extends CodeRootContainerDelegate>

Type Parameters:
D - wrapped delegate type
All Implemented Interfaces:
Component, Container, Lookup.Provider, Root

public class CodeRootContainer<D extends CodeRootContainerDelegate> extends CodeRoot<D> implements Container
A
invalid reference
Root
container instance that is rewritable at runtime. The CodeRootContainer itself remains constant, but passes most responsibility to a CodeRootContainer.Context wrapping a CodeRootContainerDelegate (user code). This component handles switching from one context to the next. A CodeRoot cannot be created directly - see CodeFactory.
  • Method Details

    • children

      public Stream<String> children()
      Description copied from interface: Container
      Get a Stream of the child IDs that this container makes publicly visible. Containers may have hidden children that can be returned from Container.getChild(java.lang.String) but are not listed here. All IDs returned should correspond to valid components, and (if provided) match the implementation of ContainerProtocol.

      A Stream is returned allowing flexibility in implementation.

      Specified by:
      children in interface Container
      Returns:
      stream of public child IDs
    • getAddress

      public ComponentAddress getAddress(Component child)
      Description copied from interface: Container
      Get the address for the provided child component, or null if the component is not a child of this container.
      Specified by:
      getAddress in interface Container
      Parameters:
      child - component
      Returns:
      address, or null of component is not a child of this container.
    • getChild

      public Component getChild(String id)
      Description copied from interface: Container
      Get child component with specific ID.
      Specified by:
      getChild in interface Container
      Parameters:
      id -
      Returns:
      Component, or null if no component with that ID exists.
    • getLookup

      public Lookup getLookup()
      Description copied from interface: Lookup.Provider
      Get the Lookup from this Provider.
      Specified by:
      getLookup in interface Lookup.Provider
      Overrides:
      getLookup in class CodeRoot<D extends CodeRootContainerDelegate>
      Returns:
      lookup
    • hierarchyChanged

      public void hierarchyChanged()
      Description copied from interface: Component
      Notify the component that a change has happened in its component hierarchy. For example its direct parent or an ancestor has changed. This method will be called after parentNotify() if the result of an immediate parent change.
      Specified by:
      hierarchyChanged in interface Component
      Overrides:
      hierarchyChanged in class CodeRoot<D extends CodeRootContainerDelegate>
    • write

      public void write(TreeWriter writer)
      Description copied from interface: Component
      If supported, write the state of this component to the provided TreeWriter. This should allow for the component to be recreated in as close to its current state as possible.

      To fully support this method, the Component should write its type, component info, and property values, in that order. It may also add custom annotations.

      The component should delegate to Container.getType(org.praxislive.core.Component) to find its type rather than relying directly on ComponentInfo.KEY_COMPONENT_TYPE.

      The default implementation of this method does nothing.

      Specified by:
      write in interface Component
      Specified by:
      write in interface Container
      Overrides:
      write in class CodeComponent<D extends CodeRootContainerDelegate>
      Parameters:
      writer - TreeWriter to write to