@Test public void testMatchWithSeveralSegments() throws Exception { Route route = new Route( "/stocks/:exchange/:stock", null ); StompletActivator match = route.match( "/stocks/NASDAQ/AAPL" ); assertNotNull( match ); assertEquals( "NASDAQ", match.get( "exchange" ) ); assertEquals( "AAPL", match.get( "stock" ) ); match = route.match( "/stocks/NYSE/RHT" ); assertNotNull( match ); assertEquals( "NYSE", match.get( "exchange" ) ); assertEquals( "RHT", match.get( "stock" ) ); match = route.match( "/bonds/AAPL" ); assertNull( match ); match = route.match( "/bonds/whut/AAPL" ); assertNull( match ); }
public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i], routeMatcher.group( i + 1 ) ); } return new StompletActivator( this, destination, matches ); } return null; }
Route { public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i], routeMatcher.group( i + 1 ) ); } return new StompletActivator( this, destination, matches ); } return null; } }
Route { public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i], routeMatcher.group( i + 1 ) ); } return new StompletActivator( this, destination, matches ); } return null; } Route(String pattern, Stomplet stomplet); }
Route { public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i], routeMatcher.group( i + 1 ) ); } return new StompletActivator( this, destination, matches ); } return null; } Route(String pattern, Stomplet stomplet); StompletActivator match(String destination); String getPatternString(); Stomplet getStomplet(); String toString(); }
Route { public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i], routeMatcher.group( i + 1 ) ); } return new StompletActivator( this, destination, matches ); } return null; } Route(String pattern, Stomplet stomplet); StompletActivator match(String destination); String getPatternString(); Stomplet getStomplet(); String toString();  }