org.hotrod.utils.ImportsRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hotrod-generator Show documentation
Show all versions of hotrod-generator Show documentation
HotRod is an ORM for Java, Spring and SpringBoot.
The newest version!
package org.hotrod.utils;
import java.util.HashSet;
import java.util.Set;
public class ImportsRenderer {
private Set imports = new HashSet();
private StringBuilder sb = new StringBuilder();
public void add(final String imp) {
if (!this.imports.contains(imp)) {
this.imports.add(imp);
this.sb.append("import " + imp + ";\n");
}
}
public void add(final Class> c) {
add(c.getName());
}
public void newLine() {
this.sb.append("\n");
}
public void comment(final String comment) {
this.sb.append("// " + comment + "\n");
}
public String render() {
return sb.toString();
}
}