@Test public void shouldResolveJavaTypeInstanceByClassAndType() { assertThat(resolver.getTypeInstances(symbol("scotch.data.num.Num"), asList(intType().toDescriptor())), hasItem(typeInstance( "scotch.data.num", "scotch.data.num.Num", asList(intType()), MethodSignature.fromMethod(NumInt.class, "instance") ))); }
@Override public Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types) { search(symbol); search(types); return Optional.ofNullable(typeInstances.get(symbol)) .flatMap(instances -> instances.keySet().stream() .filter(parameters -> parametersMatch(parameters, types)) .map(instances::get) .findFirst()) .orElse(ImmutableSet.of()); }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types) { search(symbol); search(types); return Optional.ofNullable(typeInstances.get(symbol)) .flatMap(instances -> instances.keySet().stream() .filter(parameters -> parametersMatch(parameters, types)) .map(instances::get) .findFirst()) .orElse(ImmutableSet.of()); } }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types) { search(symbol); search(types); return Optional.ofNullable(typeInstances.get(symbol)) .flatMap(instances -> instances.keySet().stream() .filter(parameters -> parametersMatch(parameters, types)) .map(instances::get) .findFirst()) .orElse(ImmutableSet.of()); } ClassLoaderResolver(Optional<File> optionalOutputPath, ClassLoader parent);  ClassLoaderResolver(Optional<File> optionalOutputPath, URL[] urls, ClassLoader parent); }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types) { search(symbol); search(types); return Optional.ofNullable(typeInstances.get(symbol)) .flatMap(instances -> instances.keySet().stream() .filter(parameters -> parametersMatch(parameters, types)) .map(instances::get) .findFirst()) .orElse(ImmutableSet.of()); } ClassLoaderResolver(Optional<File> optionalOutputPath, ClassLoader parent);  ClassLoaderResolver(Optional<File> optionalOutputPath, URL[] urls, ClassLoader parent); static ClassLoaderResolver resolver(Optional<File> optionalOutputPath); Class<?> define(GeneratedClass generatedClass); List<Class<?>> defineAll(List<GeneratedClass> generatedClasses); @Override Optional<SymbolEntry> getEntry(Symbol symbol); @Override Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types); @Override Set<TypeInstanceDescriptor> getTypeInstancesByModule(String moduleName); }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types) { search(symbol); search(types); return Optional.ofNullable(typeInstances.get(symbol)) .flatMap(instances -> instances.keySet().stream() .filter(parameters -> parametersMatch(parameters, types)) .map(instances::get) .findFirst()) .orElse(ImmutableSet.of()); } ClassLoaderResolver(Optional<File> optionalOutputPath, ClassLoader parent);  ClassLoaderResolver(Optional<File> optionalOutputPath, URL[] urls, ClassLoader parent); static ClassLoaderResolver resolver(Optional<File> optionalOutputPath); Class<?> define(GeneratedClass generatedClass); List<Class<?>> defineAll(List<GeneratedClass> generatedClasses); @Override Optional<SymbolEntry> getEntry(Symbol symbol); @Override Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types); @Override Set<TypeInstanceDescriptor> getTypeInstancesByModule(String moduleName);  }