Code generation for any platform.
Run the following commands after you've setup your GO workspace.
go get github.com/cfmobile/levo
go build
brew tap cfmobile/homebrew-tap
brew install levolevo -t <templates> -m <model>e.g. levo -t template.lt -m "User id:long name:string age:int"
In the example above, the contents of template.lt looks something like this:
{{$package := .PackageName}}
{{$path := .PackagePath}}
{{range .Models}}
<<levo filename:{{titlecase .Name}}.java directory:src/{{$path}}/models>>
package {{$package}}.models;
import java.util.ArrayList;
public class {{titlecase .Name}} {{if .Parent}}extends {{.Parent}} {{end}}{
public static class List extends ArrayList<{{titlecase .Name}}> {
private static final long serialVersionUID = 1L;
}
{{range .Properties}}!>
private {{toJavaType .}} m{{titlecase .LocalIdentifier}};
{{end}}!>
{{range .Properties}}!>
public {{toJavaType .}} get{{titlecase .LocalIdentifier}}() {
return m{{titlecase .LocalIdentifier}};
}
public void set{{titlecase .LocalIdentifier}}({{toJavaType .}} {{camelcase .LocalIdentifier}}) {
m{{titlecase .LocalIdentifier}} = {{camelcase .LocalIdentifier}};
}
{{end}}!>
}
<<levo>>
{{end}}