Portlet Factory, Version 6.1.2
Deferring a builder call to another phase
This is typical sample code that would appear in the doBuilderCall method of a builder class that wants to defer itself to another phase.
GenContext genContext; WebApp webApp; BuilderCall builderCall; String name; String basisVariable; public void doBuilderCall(GenContext genContext, WebApp webApp, BuilderCall builderCall, BuilderInputs builderInputs) if (genContext.getGenerationPhase().equals(GenContext.PHASE_CONSTRUCTION)) this.genContext = genContext; this.webApp = webApp; this.builderCall = builderCall; // code to get all the builder inputs name = builderInputs.getString(Constants.Name, null); basisVariable = builderInputs.getString(Constants.BasisVariable, null); // Defer to PostConstruction phase if it is still desired. boolean defer = constructionPhase(); if (defer) genContext.deferBuilderCall(GenContext.PHASE_POSTCONSTRUCTION, builderCall); else postConstructionPhase(); public boolean constructionPhase() boolean deferToPostConstruction = true; // Construction phase work here. return deferToPostConstruction; public void postConstructionPhase() // PostConstruction phase work here. }Parent topic: Multi-phase builder generation behavior
Library | Support |