Class CodeGenerator
java.lang.Object
com.illumon.iris.db.v2.utils.codegen.CodeGenerator
public abstract class CodeGenerator extends Object
-
Constructor Summary
Constructors Constructor Description CodeGenerator()
-
Method Summary
Modifier and Type Method Description void
activateAllChoices(String tag)
void
activateAllOptionals(String tag)
CodeGenerator
activateChoice(String tag)
CodeGenerator
activateOptional(String tag)
void
assertNoUnresolvedVariables()
static CodeGenerator
block(Object... args)
Open new block.String
build()
static CodeGenerator
choice(Object... args)
Same "tail wagging the dog" comment applies.static CodeGenerator
create(Object... args)
CodeGenerator
freeze()
static CodeGenerator
indent(Object... args)
Begin new indentation scope, e.g.CodeGenerator
instantiateNewRepeated(String tag)
static CodeGenerator
optional(Object... args)
Same "tail wagging the dog" comment applies.static CodeGenerator
repeated(Object... args)
Same "tail wagging the dog" comment applies.void
replace(String metaVariable, String replacement)
static CodeGenerator
samelineBlock(Object... args)
The tail wagging the dog: the proper method signature for this method isCodeGenerator samelineBlock(String prefix, Object... args)
But when I do that, IntelliJ by default litters up the code with parameter hints, which (if the programmer doesn't turn them off), makes the templated code much more unreadable.
-
Constructor Details
-
CodeGenerator
public CodeGenerator()
-
-
Method Details
-
create
-
block
Open new block. Opening brace on same line. -
indent
Begin new indentation scope, e.g. to format multiple lines of function parameters. -
samelineBlock
The tail wagging the dog: the proper method signature for this method isCodeGenerator samelineBlock(String prefix, Object... args)
But when I do that, IntelliJ by default litters up the code with parameter hints, which (if the programmer doesn't turn them off), makes the templated code much more unreadable. So instead we just pull out the parameter from here.- Parameters:
args
- A prefix (of type String) like "else", followed by an arbitrary number of template lines.- Returns:
- The new component.
-
optional
Same "tail wagging the dog" comment applies. -
choice
Same "tail wagging the dog" comment applies. -
repeated
Same "tail wagging the dog" comment applies. -
replace
-
activateOptional
-
activateChoice
-
activateAllOptionals
-
activateAllChoices
-
instantiateNewRepeated
-
build
-
freeze
-
assertNoUnresolvedVariables
public void assertNoUnresolvedVariables()
-