Class RoutingSpec


  • public class RoutingSpec
    extends java.lang.Object
    Along with the RoutingTableSpec, RouteSpec and HopSpec, this holds the routing specifications for all protocols. The only way a client can configure or alter the settings of a message bus instance is through these classes.

    This class is the root spec class for configuring message bus routing.

    Author:
    Simon Thoresen Hult
    • Constructor Detail

      • RoutingSpec

        public RoutingSpec()
        Creates an empty specification.
      • RoutingSpec

        public RoutingSpec​(boolean verify)
        Creates an empty specification.
        Parameters:
        verify - Whether or not this should be verified.
      • RoutingSpec

        public RoutingSpec​(RoutingSpec spec)
        Implements the copy constructor.
        Parameters:
        spec - the spec to copy.
    • Method Detail

      • hasTables

        public boolean hasTables()
        Returns whether or not there are routing table specs contained in this.
        Returns:
        True if there is at least one table.
      • getNumTables

        public int getNumTables()
        Returns the number of routing table specs that are contained in this.
        Returns:
        The number of routing tables.
      • getTable

        public RoutingTableSpec getTable​(int i)
        Returns the routing table spec at the given index.
        Parameters:
        i - The index of the routing table to return.
        Returns:
        The routing table at the given index.
      • setTable

        public RoutingSpec setTable​(int i,
                                    RoutingTableSpec table)
        Sets the routing table spec at the given index.
        Parameters:
        i - The index at which to set the routing table.
        table - The routing table to set.
        Returns:
        This, to allow chaining.
      • addTable

        public RoutingSpec addTable​(RoutingTableSpec table)
        Adds a routing table spec to the list of tables.
        Parameters:
        table - The routing table to add.
        Returns:
        This, to allow chaining.
      • removeTable

        public RoutingTableSpec removeTable​(int i)
        Returns the routing table spec at the given index.
        Parameters:
        i - The index of the routing table to remove.
        Returns:
        The removed routing table.
      • clearTables

        public RoutingSpec clearTables()
        Clears the list of routing table specs contained in this.
        Returns:
        This, to allow chaining.
      • verify

        public boolean verify​(ApplicationSpec app,
                              java.util.List<java.lang.String> errors)
        Verifies the content of this against the given application.
        Parameters:
        app - The application to verify against.
        errors - The list of errors found.
        Returns:
        True if no errors where found.
      • toConfig

        public void toConfig​(java.lang.StringBuilder cfg,
                             java.lang.String prefix)
        Appends the content of this to the given config string builder.
        Parameters:
        cfg - The config to add to.
        prefix - The prefix to use for each add.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object