public Key key(final Type<?> type) { return key(type, TypeList.empty()); }
public <T> Type<T> getGenericType(final Type<T> typeDefinition, final TypeList typeArguments) { final Key key = key( typeDefinition.getErasedClass(), typeArguments ); Type genericType = _map.get(key); if (genericType == null) { genericType = new GenericType( typeDefinition.getGenericTypeDefinition(), typeArguments ); final Type existing = _map.put(key, genericType); if (existing != null) { return existing; } } return genericType; }
public <T> Type<T> getGenericType(final Type<T> typeDefinition, final TypeList typeArguments) { final Key key = key( typeDefinition.getErasedClass(), typeArguments ); Type genericType = _map.get(key); if (genericType == null) { genericType = new GenericType( typeDefinition.getGenericTypeDefinition(), typeArguments ); final Type existing = _map.put(key, genericType); if (existing != null) { return existing; } } return genericType; }
public <T> Type<T> getGenericType(final Type<T> type, final TypeList typeArguments) { final Key key = key( type.isGenericType() ? type.getGenericTypeDefinition() : type, typeArguments ); Type genericType = _map.get(key); if (genericType == null) { genericType = new GenericType( type.getGenericTypeDefinition(), typeArguments ); final Type existing = _map.put(key, genericType); if (existing != null) { return existing; } } return genericType; }
public void add(final Type type) { final TypeList typeArguments; if (type.isGenericType()) { typeArguments = type.getTypeBindings().getBoundTypes(); } else { typeArguments = TypeList.empty(); } put(key(type, typeArguments), type); }
public void add(final Type type) { final TypeList typeArguments; if (type.isGenericType()) { typeArguments = type.getTypeBindings().getBoundTypes(); } else { typeArguments = TypeList.empty(); } put(key(type.getErasedClass(), typeArguments), type); }
public void add(final Type type) { final TypeList typeArguments; if (type.isGenericType()) { typeArguments = type.getTypeBindings().getBoundTypes(); } else { typeArguments = TypeList.empty(); } put(key(type.getErasedClass(), typeArguments), type); }
Type.CACHE.key( rawType.getErasedClass(), Type.list(resolvedTypeArguments)
Type.CACHE.key( rawType, Type.list(resolvedTypeArguments)
Type.CACHE.key( rawType.getErasedClass(), Type.list(resolvedTypeArguments)
@Override public Type<?> visitClassType(final Type<?> type, final TypeBindings bindings) { if (bindings.containsGenericParameter(type)) { return bindings.getBoundType(type); } final TypeBindings oldTypeBindings = type.getTypeBindings(); final TypeBindings newTypeBindings = visitTypeBindings(oldTypeBindings, bindings); if (oldTypeBindings != newTypeBindings) { final Type<?> cachedType = Type.CACHE.find( Type.CACHE.key( type.getErasedClass(), newTypeBindings.getBoundTypes() ) ); if (cachedType != null) { return cachedType; } final GenericType genericType = new GenericType( type.getGenericTypeDefinition(), newTypeBindings ); Type.CACHE.add(genericType); return genericType; } return type; }
@Override public Type<?> visitClassType(final Type<?> type, final TypeBindings bindings) { if (bindings.containsGenericParameter(type)) { return bindings.getBoundType(type); } final TypeBindings oldTypeBindings = type.getTypeBindings(); final TypeBindings newTypeBindings = visitTypeBindings(oldTypeBindings, bindings); if (oldTypeBindings != newTypeBindings) { final Type<?> cachedType = Type.CACHE.find( Type.CACHE.key( type.getErasedClass(), newTypeBindings.getBoundTypes() ) ); if (cachedType != null) { return cachedType; } final GenericType genericType = new GenericType( type.getGenericTypeDefinition(), newTypeBindings ); Type.CACHE.add(genericType); return genericType; } return type; }