This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from novoda/more_printer_customizations
Enable custom code generation
- Loading branch information
Showing
40 changed files
with
329 additions
and
743 deletions.
There are no files selected for viewing
28 changes: 0 additions & 28 deletions
28
analyzer/src/main/groovy/com/novoda/sqlite/generator/AutoFieldGenerator.groovy
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
analyzer/src/main/groovy/com/novoda/sqlite/generator/AutoPrinter.groovy
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
analyzer/src/main/groovy/com/novoda/sqlite/generator/AutoTableGenerator.groovy
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
analyzer/src/main/groovy/com/novoda/sqlite/generator/ClassEmitter.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.novoda.sqlite.generator | ||
|
||
import groovy.text.GStringTemplateEngine | ||
|
||
class ClassEmitter { | ||
|
||
def template | ||
def templateData | ||
File baseDir | ||
String packageName | ||
String className | ||
|
||
private final GStringTemplateEngine engine = new GStringTemplateEngine() | ||
|
||
public void print() { | ||
def targetDir = makeFileDir() | ||
new FileWriter("${targetDir}/${className}.java").withWriter { Writer writer -> | ||
engine.createTemplate(template) | ||
.make(access: templateData, packageName: packageName, className: className) | ||
.writeTo(writer) | ||
} | ||
} | ||
|
||
private String makeFileDir() { | ||
String packageAsDir = packageName.replaceAll(~/\./, "/") | ||
def fileDir = new File(baseDir, packageAsDir) | ||
fileDir.mkdirs() | ||
return fileDir.absolutePath | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
analyzer/src/main/groovy/com/novoda/sqlite/generator/ColumnAndroidCategory.groovy
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
analyzer/src/main/groovy/com/novoda/sqlite/generator/ColumnJavaCategory.groovy
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
analyzer/src/main/groovy/com/novoda/sqlite/generator/ColumnsGenerator.groovy
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
analyzer/src/main/groovy/com/novoda/sqlite/generator/DBPrinter.groovy
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
analyzer/src/main/groovy/com/novoda/sqlite/generator/GetAutoTableCreateGenerator.groovy
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.