InformationMapping { public void fillDictionary(String prefix, Map<String, Class> dic, boolean compact) { synchronized (this) { for (Entry<String, TFunction<S, ?>> entry : map.entrySet()) { dic.put(InformationSet.item(prefix, entry.getKey()), entry.getValue().targetClass); } if (compact) { for (Entry<String, TListFunction<S, ?>> entry : lmap.entrySet()) { TListFunction<S, ?> fn = entry.getValue(); if (fn.start == fn.end) { dic.put(InformationSet.item(prefix, wcKey(entry.getKey(), '?')), fn.targetClass); } else { dic.put(InformationSet.item(prefix, wcKey(entry.getKey(), '*')), fn.targetClass); } } } else { for (Entry<String, TListFunction<S, ?>> entry : lmap.entrySet()) { TListFunction<S, ?> fn = entry.getValue(); if (fn.start == fn.end) { dic.put(InformationSet.item(prefix, listKey(entry.getKey(), fn.start)), fn.targetClass); } else { for (int i = fn.start; i <= fn.end; ++i) { dic.put(InformationSet.item(prefix, listKey(entry.getKey(), i)), fn.targetClass); } } } } } } InformationMapping(Class<S> sourceClass); static String listKey(String prefix, int item); static String wcKey(String prefix, char wc); static int listItem(String prefix, String key); static boolean isIParamItem(String prefix, String key); static void updateAll(ClassLoader loader); static boolean update(Class sourceClass, ClassLoader loader); void update(); void update(ClassLoader loader); void set(String name, Class<T> tclass, Function<S, T> extractor); void set(String name, Function<S, TsData> extractor); void setList(String prefix, int start, int end, Class<T> tclass, BiFunction<S, Integer, T> extractor); void setList(String prefix, int start, int end, BiFunction<S, Integer, TsData> extractor); void set(String prefix, int defparam, Class<T> tclass, BiFunction<S, Integer, T> extractor); void set(String prefix, int defparam, BiFunction<S, Integer, TsData> extractor); void fillDictionary(String prefix, Map<String, Class> dic, boolean compact); String[] keys(); boolean contains(String id); T getData(S source, String id, Class<T> tclass); Map<String, T> searchAll(S source, String pattern, Class<T> tclass); static final String LSTART; }
@Test public void testDictionary() { LinkedHashMap<String, Class> dic = new LinkedHashMap(); mapping.fillDictionary(null, dic, true); dic.entrySet().stream().forEach(x -> { System.out.print(x.getKey()); System.out.print('\t'); System.out.println(x.getValue()); } ); }