What we haveA complex tree model stored across multiple XML filesJava model classes which represent the XML modelAll classes as POJOsAll classes annotated with jaxbjaxb to read the XML filesA tree of handler classeseach handler is responsible for handling a layer inside the model tree or specific elementsthe handler classes are created using guice as DI frameworkProblematic bitSome handlers need data that is processed in layers that were parsed earlier.example:RootHandler\- ChildHandler   \- GrandChildHandlerIn this example the GrandChildHandler needs the data which the RootHandler computed. At the moment the code looks similar to this:# roothandler:Data rootData = compute();childHandler.handleLayer(rootData);# childHandler:Data childData = compute();grandChildHandler.handleLayer(rootData, childData);QuestionHow should we handle this trickle down of data in the handler tree?Is it acceptable that the methods call 'explode' the further we go down in the tree?I was also thinking about storing the child data in singletons, but I fear that it will be unintuitive if this data changes depending on each computation from a childHandler.The Eclipse4 dependency framework supports context sensitive injection. Do you think it would be good to create a context object which contains all the passed down data and every handler just grabs what he needs from there?Another idea we had was to separate localized data and global data and then pass the global through different methods. My fear here is that the outside has to guarantee that the most recent global data is set.Is there some standard solution for this? All Dependency injections tutorials just ignore bigger projects :(
Data Flow in Dependency Injection
dependency injection