Class AbstractComponent

    • Field Detail

      • isDeconstructable

        protected final boolean isDeconstructable
    • Constructor Detail

      • AbstractComponent

        protected AbstractComponent()
        Creates a new component which is invalid until initId(com.yahoo.component.ComponentId) is called on it. The dependency injection framework (DI) will always set the id, so components to be created via DI do not have to implement other constructors, and should not set the id themselves.
      • AbstractComponent

        protected AbstractComponent​(ComponentId id)
        Creates a new component with an id. Only for testing and components that are not created via dependency injection.
        Throws:
        NullPointerException - if the given id is null
    • Method Detail

      • initId

        public final void initId​(ComponentId id)
        Initializes this. Always called from a constructor or the framework. Do not call.
        Specified by:
        initId in interface Component
      • getId

        public final ComponentId getId()
        Do NOT call at construction time. Returns the id of this component.
        Specified by:
        getId in interface Component
      • hasInitializedId

        public final boolean hasInitializedId()
        DO NOT CALL, for internal use only,
      • getIdString

        public final String getIdString()
        DO NOT CALL, for internal use only,
      • getClassName

        public String getClassName()
      • compareTo

        public int compareTo​(Component other)
        Order by id order. It is permissible to change the order definition in subclasses
        Specified by:
        compareTo in interface Comparable<Component>
      • deconstruct

        public void deconstruct()
        Implement this to perform any cleanup of structures or resources allocated in the constructor, before this component is removed.

        All other calls to this component is completed before this method is called. It will only be called once. It should block while doing cleanup tasks and return when this class is ready for garbage collection. This method is called in reverse dependency order, so a component will be deconstructed after any other components it is injected into.

        This default implementation does nothing.

        Specified by:
        deconstruct in interface Deconstructable
      • isDeconstructable

        public final boolean isDeconstructable()
        Returns:
        true if this component has a non-default implementation of the deconstruct() method.
      • setIsDeconstructable

        protected boolean setIsDeconstructable()