udoprog / genco

A whitespace-aware quasiquoter for beautiful code generation.
Apache License 2.0
183 stars 12 forks source link

Add "import xxxx.xxx" support on java class generation. #3

Closed sidneywang closed 5 years ago

sidneywang commented 5 years ago

How can I add "import xxx.xxx.xx" when generate a class file.

sidneywang commented 5 years ago

Is there any convenient way to do that? I use toks! to make it.

udoprog commented 5 years ago

Yeah, you use imported tokens: https://github.com/udoprog/genco/blob/master/src/java/mod.rs#L502

Examples here: https://github.com/reproto/reproto/blob/master/lib/backend-java/src/compiler.rs#L82