BlotterResource { static boolean isSecurity(Class<?> type) { if (type == null) { return false; } else if (ManageableSecurity.class.equals(type)) { return true; } else { return isSecurity(type.getSuperclass()); } } BlotterResource(SecurityMaster securityMaster, PortfolioMaster portfolioMaster, PositionMaster positionMaster); @Context void setServletContext(final ServletContext servletContext); @GET @Produces(MediaType.TEXT_HTML) @Path("types") String getTypes(); @SuppressWarnings("unchecked") @GET @Produces(MediaType.TEXT_HTML) @Path("types/{typeName}") String getStructure(@PathParam("typeName") String typeName); @GET @Produces(MediaType.APPLICATION_JSON) @Path("securities/{securityExternalId}") String getSecurityJSON(@PathParam("securityExternalId") String securityExternalIdStr); @GET @Produces(MediaType.APPLICATION_JSON) @Path("trades/{tradeId}") String getTradeJSON(@PathParam("tradeId") String tradeIdStr); @DELETE @Produces(MediaType.APPLICATION_JSON) @Path("trades/{tradeId}") Response deleteTrade(@PathParam("tradeId") String tradeIdStr); @GET @Produces(MediaType.APPLICATION_JSON) @Path("positions/{positionId}") String getPositionJSON(@PathParam("positionId") String positionIdStr); @POST @Path("trades") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) Response createTrade(@Context UriInfo uriInfo, @FormParam("trade") String jsonStr); @PUT @Path("positions/{positionIdStr}") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) void updatePosition(@FormParam("trade") String jsonStr, @PathParam("positionIdStr") String positionIdStr); @PUT @Path("trades/{tradeIdStr}") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) void updateTrade(@FormParam("trade") String jsonStr, @PathParam("tradeIdStr") String tradeIdStr); @Path("lookup") BlotterLookupResource getLookupResource();  }
@Test public void isSecurity() { assertTrue(BlotterResource.isSecurity(ManageableSecurity.class)); assertTrue(BlotterResource.isSecurity(SwapSecurity.class)); assertTrue(BlotterResource.isSecurity(GovernmentBondSecurity.class)); assertFalse(BlotterResource.isSecurity(FixedInterestRateLeg.class)); }