Interface MdibEntity

  • All Known Implementing Classes:
    MdibEntityImpl

    public interface MdibEntity
    Representation of any MDIB object within a containment tree.

    Any entity contains a list of states, a descriptor and an optional set of children. MdibEntity is an immutable class with read access only.

    • Method Detail

      • getLastChanged

        MdibVersion getLastChanged()
        Gets the MDIB version of the entity where it has been changed the last time.
        Returns:
        an MDIB version.
      • getChildren

        List<String> getChildren()
        Obtain a read-only list of the MDIB entity's child handles.
        Returns:
        readable list of children currently associated with the entity.
      • getDescriptor

        AbstractDescriptor getDescriptor()
        Obtain the entity's descriptor.
        Returns:
        descriptor information currently associated with the entity.
      • getDescriptor

        <T extends AbstractDescriptorOptional<T> getDescriptor​(Class<T> theClass)
        Obtains the entity's descriptor as a given type.
        Type Parameters:
        T - the descriptor class type.
        Parameters:
        theClass - the class to cast.
        Returns:
        descriptor information currently associated with the entity.
      • getHandle

        String getHandle()
        Unique name to identify the entity.

        Short-hand for getDescriptor().getHandle()

        Returns:
        the entity's unique handle.
      • getStates

        List<AbstractState> getStates()
        Obtains a copy of the MDIB entity's state list.
        Returns:
        list of states currently associated with the entity.
      • getStates

        <T extends AbstractStateList<T> getStates​(Class<T> theClass)
        Obtains the list of states cast to a specific type.
        Type Parameters:
        T - the state class type.
        Parameters:
        theClass - the class to cast.
        Returns:
        list of cast states currently associated with the entity. Please note that this list is empty either if there is no state available or there is no state available with the given type information.
      • getFirstState

        <T extends AbstractStateOptional<T> getFirstState​(Class<T> theClass)
        Obtains the first state if available.

        This function is useful to retrieve single state information.

        Type Parameters:
        T - the state class type.
        Parameters:
        theClass - the class to cast.
        Returns:
        the cast type of Optional.empty() if there is no first state or a class cast error.
      • doIfSingleState

        MdibEntity.StateAlternative<List<AbstractMultiState>> doIfSingleState​(Consumer<AbstractState> consumer)
        Convenience method to execute code if en entity hosts a single-state.
        Parameters:
        consumer - lambda that is supposed to be executed if the entity is a single state host.
        Returns:
        an alternative to execute if the opposite turns out.
      • doIfMultiState

        MdibEntity.StateAlternative<AbstractState> doIfMultiState​(Consumer<List<AbstractMultiState>> consumer)
        Convenience method to execute code if en entity hosts a multi-state.
        Parameters:
        consumer - lambda that is supposed to be executed if the entity is a multi-state host.
        Returns:
        an alternative to execute if the opposite turns out.
      • getDescriptorClass

        Class<? extends AbstractDescriptor> getDescriptorClass()
        Gets the descriptor class.

        Short-hand for getDescriptor().getClass().

        Returns:
        the descriptor class of the entity.
      • getStateClass

        Class<? extends AbstractState> getStateClass()
        Gets the state class.
        Returns:
        the state class of the entity.