TypeAliasRegistry { @SuppressWarnings("unchecked") public <T> Class<T> resolveAlias(String string) { try { if (string == null) { return null; } String key = string.toLowerCase(Locale.ENGLISH); Class<T> value; if (TYPE_ALIASES.containsKey(key)) { value = (Class<T>) TYPE_ALIASES.get(key); } else { value = (Class<T>) Resources.classForName(string); } return value; } catch (ClassNotFoundException e) { throw new TypeException("Could not resolve type alias '" + string + "'. Cause: " + e, e); } } TypeAliasRegistry(); @SuppressWarnings("unchecked") // throws class cast exception as well if types cannot be assigned Class<T> resolveAlias(String string); void registerAliases(String packageName); void registerAliases(String packageName, Class<?> superType); void registerAlias(Class<?> type); void registerAlias(String alias, Class<?> value); void registerAlias(String alias, String value); Map<String, Class<?>> getTypeAliases();  }
@Test public void shouldFetchArrayType() { TypeAliasRegistry typeAliasRegistry = new TypeAliasRegistry(); assertEquals(Byte[].class, typeAliasRegistry.resolveAlias("byte[]")); }