Code generation and export tool
- Write the template and place it in the ./resources folder
- Write the parameter.properties file
- Update and run Main-Class: com.lyrieek.templates.Export
-
Create
simpleTest
new folder calledsimpleTest
in your resources, it's like using a command like thiscd resources mkdir simpleTest
-
Write a file called
test.template
insimpleTest
resources/simpleTest/test.template
var \{test} = 'Hello templates' console.log(\{test})
-
Replace the
com.lyrieek.templates.Export
moduleFolder
constant withsimpleTest
, when you run it, you get a fileresources/simpleTest/parameter.properties
test=
-
Change the value of test to any value, For example
test=foo
-
Run
com.lyrieek.templates.Export
again, get results
resources/simpleTest/test.txt
var foo = 'Hello templates'
console.log(foo)
file.common.prefix
output file starts with this by defaultfile.common.ext
default file extensionfile.builtIn.ext
extension are already built in and do not need to be added
Under normal conditions, you need to avoid “.” in parameter, because using it means you're going to call some decorator function, these methods are listed below
Function name | Description | Example | Example result |
---|---|---|---|
.upper | upper case | \{v.upper}, v=abC | ABC |
.lower | lower case | \{v.lower}, v=AbC | abc |
.camel | camel nomenclature | \{v.camel}, v=sweet bean | sweetBean |
.pascal | pascal nomenclature | \{v.pascal}, v=sweet bean | SweetBean |
.hungarian | Hungarian nomenclature | \{v.hungarian}, v=sweet bean | sweet_bean |
.natural | natural language | \{v.natural}, v=SweetBean | sweet bean |
Apache-2.0