EventMappings.java 1006 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.udapsoft.waf.system.handler.dao;
  2. import java.util.HashMap;
  3. import java.util.Iterator;
  4. public class EventMappings {
  5. HashMap<String, EventMapping> eventMappingHashMap = null;
  6. public EventMappings() {
  7. eventMappingHashMap = new HashMap<String, EventMapping>();
  8. }
  9. public void put(String screen, String event, EventMapping eventMapping) {
  10. this.eventMappingHashMap.put(key(screen, event), eventMapping);
  11. }
  12. public EventMapping get(String screen, String event) {
  13. return (EventMapping) eventMappingHashMap.get(key(screen, event));
  14. }
  15. public int size() {
  16. return this.eventMappingHashMap.size();
  17. }
  18. private String key(String screen, String event) {
  19. return screen + "!" + event;
  20. }
  21. public String toString() {
  22. String str = "";
  23. int i = 0;
  24. for (Iterator<String> itr = eventMappingHashMap.keySet().iterator(); itr.hasNext(); i++) {
  25. String key = (String) itr.next();
  26. str += "index(" + i + ")=" + this.eventMappingHashMap.get(key).toString() + "\n";
  27. }
  28. return str;
  29. }
  30. }