java - Injection via Guice into an Immutables class -


i'm using 2 common packages, immutables , guice. first thing happens @ runtime load setting environment , other sources settings singleton, non-immutable config class, let's call myconfig, example, exposes public getsettingx() method.

 myconfig myconfig = myconfig.intialize().create();    string settingx = myconfig.getsettingx(); 

i have 1 abstract immutable class, call abstractimmutable. @ instantiation needs set field based on myconfig.getsettingx().

@value.immutable abstract class abstractimmutable {    abstract string getsettingx(); // ideally set  } 

now, typically inject myconfig classes using guice, , liket figure way implementations of abstractimmutable class (to avoid manually having inject myconfig class every time build object--whole reason using juice begin with, manage di). however, since concrete immutables classes generated @ compile, doesn't work usual guice injection annotations.

there's indication on immutables site of using builder package annotate static factory method, can't seem figure how add abstract immutable class.

anyone have suggestions?


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -