if (clz == Integer.TYPE) return CORE_TYPE_INT;
if (clz == Long.TYPE) return CORE_TYPE_LONG;
// Barring that, we may have recently constructed an instance:
ClassKey key = new ClassKey(clz);
JavaType result = _typeCache.get(key); // ok, cache object is synced
if (result != null) {
return result;
}
// If context was needed, weed do:
/*
if (context == null) {
context = new TypeBindings(this, cls);
}
*/
// First: do we have an array type?
if (clz.isArray()) {
result = ArrayType.construct(_constructType(clz.getComponentType(), null), null, null);
/* Also: although enums can also be fully resolved, there's little
* point in doing so (T extends Enum<T>) etc.
*/
} else if (clz.isEnum()) {
result = new SimpleType(clz);
/* Maps and Collections aren't quite as hot; problem is, due
* to type erasure we often do not know typing and can only assume
* base Object.
*/
} else if (Map.class.isAssignableFrom(clz)) {
result = _mapType(clz);
} else if (Collection.class.isAssignableFrom(clz)) {
result = _collectionType(clz);
} else {
// 29-Sep-2014, tatu: We may want to pre-resolve well-known generic types
if (Map.Entry.class.isAssignableFrom(clz)) {
JavaType[] pts = this.findTypeParameters(clz, Map.Entry.class);
JavaType kt, vt;
if (pts == null || pts.length != 2) {
kt = vt = unknownType();
} else {
kt = pts[0];
vt = pts[1];