hardayal / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

Add getType() to TypeSafeMatcher #65

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In most cases, TypeSafeMatcher can just do it's thing and match only the 
specific type.

However, we have a service that has already indexed 10,000's of objects by 
type, and so we would like:

  TypeSafeMatcher matcher;
  Collection objectsOfClass = service.getObjects(matcher.getType());
  List myObjects = select(objectsOfClass, matcher);

Original issue reported on code.google.com by stephen....@gmail.com on 24 Feb 2009 at 1:17

GoogleCodeExporter commented 8 years ago
This seems like quite an obscure use for us to change the API.

My suggestions are either to write your own subclass of TypeSafeMatcher, or 
wrap this bit of code in a helper 
method to implement passing the type to the service and creating a typed 
matcher.

Original comment by smgfree...@gmail.com on 28 Feb 2009 at 11:15