@Override public String toString() { return qualifiedName(); }
public String qualifiedName() { return typeInfo.qualifiedName(); }
public String qualifiedName() { return typeInfo.qualifiedName(); }
@Override public final boolean equals(final Object obj) { if (obj == this) { return true; } if (obj instanceof TypeInfo) { final TypeInfo that = (TypeInfo) obj; return Objects.equals(qualifiedName(), that.qualifiedName()); } else { return false; } }
public PeerResourceBuilder(TypeInfo typeInfo, String suffix) { String qualifiedName = typeInfo.qualifiedName(); String fileName = qualifiedName.replace(".", FILE_SEPARATOR); this.fileName = fileName + "." + suffix; }
public PeerResourceBuilder(TypeInfo typeInfo, String suffix) { String qualifiedName = typeInfo.qualifiedName(); String fileName = qualifiedName.replace(".", FILE_SEPARATOR); this.fileName = fileName + "." + suffix; }
@Override public final int hashCode() { return Objects.hash(qualifiedName()); }
private CompiledTypeInfo tryToLoadType(TypeInfo typeInfo) throws ClassNotFoundException { String qualifiedName = typeInfo.qualifiedName(); Class<?> type = Class.forName(qualifiedName); return CompiledTypeInfo.of(typeInfo, type); }
private CompiledTypeInfo tryToLoadType(TypeInfo typeInfo) throws ClassNotFoundException { String qualifiedName = typeInfo.qualifiedName(); Class<?> type = Class.forName(qualifiedName); return CompiledTypeInfo.of(typeInfo, type); }
private Artifact typeInfo(TypeInfo typeInfo) { typeInfoMap.put(typeInfo.qualifiedName(), typeInfo); typeInfoListenerSet.forEach(listener -> listener.onTypeInfo(typeInfo)); return Artifact.empty(); }
CompiledTypeInfo compile(TypeInfo typeInfo, ProcessingEnvironment processingEnv) throws IOException, ClassNotFoundException { PathInfo pathInfo = pathInfo(typeInfo); String classOutputPath = classOutputPath(processingEnv); List<String> options = ImmutableList.<String> builder() .add(pathInfo.file()) .add("-d") .add(classOutputPath) .add("-classpath") .add(classPath + PATH_SEPARATOR + pathInfo.sourceLocation()) .add("-proc:none") .build(); JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); javac.run(null, System.out, System.err, options.toArray(new String[] {})); URL[] urls = ImmutableList.<URL> builder() .addAll(urlList) .add(new File(classOutputPath + FILE_SEPARATOR).toURI().toURL()) .build() .toArray(new URL[] {}); try (URLClassLoader loader = new URLClassLoader(urls, getClass().getClassLoader())) { Class<?> type = Class.forName(typeInfo.qualifiedName(), true, loader); return CompiledTypeInfo.of(typeInfo, type); } }
CompiledTypeInfo compile(TypeInfo typeInfo, ProcessingEnvironment processingEnv) throws IOException, ClassNotFoundException { PathInfo pathInfo = pathInfo(typeInfo); String classOutputPath = classOutputPath(processingEnv); List<String> options = ImmutableList.<String> builder() .add(pathInfo.file()) .add("-d") .add(classOutputPath) .add("-classpath") .add(classPath + PATH_SEPARATOR + pathInfo.sourceLocation()) .add("-proc:none") .build(); JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); javac.run(null, System.out, System.err, options.toArray(new String[] {})); URL[] urls = ImmutableList.<URL> builder() .addAll(urlList) .add(new File(classOutputPath + FILE_SEPARATOR).toURI().toURL()) .build() .toArray(new URL[] {}); try (URLClassLoader loader = new URLClassLoader(urls, getClass().getClassLoader())) { Class<?> type = Class.forName(typeInfo.qualifiedName(), true, loader); return CompiledTypeInfo.of(typeInfo, type); } }