Guest User

Untitled

a guest
Jul 6th, 2011
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. currently, PatientHandler looks like this
  2.  
  3.  
  4. @Component
  5. @Order(Ordered.LOWEST_PRECEDENCE)
  6. public class PatientHandler extends CustomDatatypeHandler implements ComplexObsHandler {
  7.  
  8. public static final Log log = LogFactory.getLog(PatientHandler.class);
  9.  
  10. public static final String HANDLER_TYPE = "PatientHandler";
  11.  
  12. /**
  13. * The default Constructor method
  14. */
  15. public PatientHandler() {
  16. super();
  17. }
  18.  
  19. --- etc.
  20.  
  21. Note // earlier I used a String variable with getters and setters instead of the constant.
  22. in the complexObshandler interface, I used to have a getHandlerType method defined, so that the api knows that anything that implements the complexObsHandler interface has a constant.
  23.  
  24. alternatively,
  25.  
  26. the ImageHandler (which also implements ComplexObsHandler) looks like this -
  27.  
  28. @Component
  29. @Order(Ordered.LOWEST_PRECEDENCE)
  30. public class ImageHandler extends AbstractHandler implements ComplexObsHandler {
  31.  
  32. public static final Log log = LogFactory.getLog(ImageHandler.class);
  33.  
  34. private Set<String> extensions;
  35.  
  36. public static final String HANDLER_TYPE = "ImageHandler";
  37.  
  38.  
  39. In short, anything that implements ComplexObsHandler needs have a constant value defined
  40.  
  41. but problem is, when I do that, I cant do this,
  42.  
  43. while (itr.hasNext()) {
  44. ComplexObsHandler obsHandler = (ComplexObsHandler) itr.next();
  45. handlerMap.put(obsHandler.getHandlerType(), obsHandler);
  46. }
  47.  
  48. (earlier, this (obsHandler.getHandlerType()) was possible becoz the interface had a getter method - so the interface knew of it. But after we moved to constants, the getter came off. Hence the issue)
  49.  
  50. now, because of this, I cant iterate through a list and call the getter on each...............
Advertisement
Add Comment
Please, Sign In to add comment