java - Best way for passing parameter from top function to bottom across entire service? -


i looking long time best way of passing parameter top function bottom.

let me explain situation. have java web-service, parameter user, header in request , need parameter in 5th function call.

controller -> api -> adaptor -> local function in adaptor -> exchange.

so, end adding parameter each function call along way passing parameter.

the problem need api calls in service. , should unique per request. (can't have massing around request).

i hope question clear, love sharpen if needed. thank you.

edit1:

explained example:

controller(string data) calls ->

api(string data) calls ->

adaptor(string data) calls ->

local private function(string data) using data in exchange(string data) call.

is there way data controller local private function in adaptor without passing parameter on each function in way? context example, must unique per rest request , not session.

i suggested create properties class hold data , pass functions. if need field (like need data now) have add properties class , use getter/setter. example:

in controller properties.setdata(data) , then: controller(properties prop) -> api(properties prop) -> ... -> local private function(properties prop) , prop.getdata();

this solution @ point, put me under big refactoring.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -