mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
Merge pull request #14 from jtsay362/master
Fix Scala constructor to output "def this(...)" instead of "public <CLASSNAME>(...)"
This commit is contained in:
commit
2218a7de49
@ -74,6 +74,8 @@ public class ScalaWriter extends AbstractCodeWriter<ScalaWriter> {
|
||||
|
||||
private static final String VAL = "val ";
|
||||
|
||||
private static final String THIS = "this";
|
||||
|
||||
private static final String TRAIT = "trait ";
|
||||
|
||||
private final Set<String> classes = new HashSet<String>();
|
||||
@ -253,13 +255,13 @@ public class ScalaWriter extends AbstractCodeWriter<ScalaWriter> {
|
||||
@Override
|
||||
public <T> ScalaWriter beginConstructor(Collection<T> parameters,
|
||||
Function<T, Parameter> transformer) throws IOException {
|
||||
beginLine(PUBLIC + type.getSimpleName()).params(parameters, transformer).append(" {").nl();
|
||||
beginLine(DEF + THIS).params(parameters, transformer).append(" {").nl();
|
||||
return goIn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScalaWriter beginConstructor(Parameter... params) throws IOException {
|
||||
beginLine(PUBLIC + type.getSimpleName()).params(params).append(" {").nl();
|
||||
beginLine(DEF + THIS).params(params).append(" {").nl();
|
||||
return goIn();
|
||||
}
|
||||
|
||||
|
||||
@ -377,7 +377,7 @@ public class ScalaWriterTest {
|
||||
|
||||
System.out.println(w);
|
||||
|
||||
assertTrue(w.toString().contains("public JavaWriterTest(a: Int) {"));
|
||||
assertTrue(w.toString().contains("def this(a: Int) {"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
Reference in New Issue
Block a user