protected static <K extends KeyValues> K getKeyValuesByCacheMap(Class<K> keyValuesType, ConcurrentMap<Object, Object> cacheMap, Object[] values) { ConcurrentMap parentMap = cacheMap; for (Object val : values) { if (parentMap == null) { break; } Object o = parentMap.get((val != null) ? val : ""); if (keyValuesType.isInstance(o)) { return ((KeyValues)o); } parentMap = null; if (!(o instanceof ConcurrentMap)) continue; parentMap = (ConcurrentMap)o; } return null; }