1 32 33 package com.jeantessier.classreader; 34 35 import java.util.*; 36 37 public class MockDispatcher implements ClassfileLoaderDispatcher { 38 public static final int ACTION = -1; 39 40 private Map counts = new HashMap(); 41 42 public int dispatch(String filename) { 43 Integer count = (Integer ) counts.get(filename); 44 45 if (count != null) { 46 count = new Integer (count.intValue() + 1); 47 } else { 48 count = new Integer (1); 49 } 50 counts.put(filename, count); 51 52 return ACTION; 53 } 54 55 public int getDispatchCount(String filename) { 56 int result = 0; 57 58 Integer count = (Integer ) counts.get(filename); 59 if (count != null) { 60 result = count.intValue(); 61 } 62 63 return result; 64 } 65 } 66 | Popular Tags |