Package com.yahoo.messagebus.routing
Class RouteSpec
java.lang.Object
com.yahoo.messagebus.routing.RouteSpec
Along with the
RoutingSpec
, RoutingTableSpec
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 contains the spec for a single route.
- Author:
- Simon Thoresen Hult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds the given hop name to this.Adds the given hop names to this.Clears the list of hops that make up this route.boolean
getHop
(int i) Returns the hop name at the given index.getName()
Returns the protocol-unique name of this route.int
Returns the number of hops that make up this route.int
hashCode()
boolean
hasHops()
Returns whether or not there are any hops in this route.removeHop
(int i) Removes the hop name at the given index.Sets the hop name for a given index.void
toConfig
(StringBuilder cfg, String prefix) Appends the content of this to the given config string builder.toString()
boolean
verify
(ApplicationSpec app, RoutingTableSpec table, List<String> errors) Verifies the content of this against the given application.
-
Constructor Details
-
RouteSpec
Creates a new named route specification.- Parameters:
name
- A protocol-unique name for this route.
-
RouteSpec
Creates a new named route specification.- Parameters:
name
- A protocol-unique name for this route.verify
- Whether or not this should be verified.
-
RouteSpec
Implements the copy constructor.- Parameters:
obj
- The object to copy.
-
-
Method Details
-
getName
Returns the protocol-unique name of this route.- Returns:
- The name.
-
getHop
Returns the hop name at the given index.- Parameters:
i
- The index of the hop to return.- Returns:
- The hop at the given index.
-
hasHops
public boolean hasHops()Returns whether or not there are any hops in this route.- Returns:
- True if there is at least one hop.
-
getNumHops
public int getNumHops()Returns the number of hops that make up this route.- Returns:
- The number of hops.
-
addHop
Adds the given hop name to this.- Parameters:
hop
- The hop to add.- Returns:
- This, to allow chaining.
-
addHops
Adds the given hop names to this.- Parameters:
hops
- The hops to add.- Returns:
- This, to allow chaining.
-
setHop
Sets the hop name for a given index.- Parameters:
i
- The index of the hop to set.hop
- The hop to set.- Returns:
- This, to allow chaining.
-
removeHop
Removes the hop name at the given index.- Parameters:
i
- The index of the hop to remove.- Returns:
- The removed hop.
-
clearHops
Clears the list of hops that make up this route.- Returns:
- This, to allow chaining.
-
verify
Verifies the content of this against the given application.- Parameters:
app
- The application to verify against.table
- The routing table to verify against.errors
- The list of errors found.- Returns:
- True if no errors where found.
-
toConfig
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
-
equals
-
hashCode
public int hashCode()
-