java - Problem auto wiring when facing object creation through methods -


I am using the classes of sections of my application. As you can see below, everything is perfect but at the same place:

  Fourthreader Reader = New CharArrayReader (Accoda.Cacharray ()); Charstream charStream = New Charstream (Reader); Scanner scanner = new scanner (fourstream); Token stream token stream = new tokenstream (scanner); ParserGeneratingAST parserGeneratingAST = New Pars Generating AST (Token Stream); - & gt; Abstract Syntactistry ast = Parser GeneratingAST.generateAST (); & Lt; - Here's the problem SymbolsTable symbolsTable = new SymbolTable (); ErrorsTable ErrorsTable = New ErrorsTable (); IconTableFillerVisitorsTransTableFillerVisitor = New SymbolTableFillerVisitor (symbols, errorTable); TypeCheckingVisitor typeCheckingVisitor = New TypeCheckingVisitor (symbolic, errorsTable); Index list index list = new direct list (); CodeGenerationVisitor Code GenerationVisitor = New CodeGenerationVisitor (Instruction list); SymbolsTableFillerVisitor.visit (AST); TypeCheckingVisitor.visit (AST); CodeGenerationVisitor.visit (AST);   

The line of the problem is

  summary syntax star = parserGeneratingAST.generateAST ();   

Is there a way to use this problem with Pico Container? If possible, I want to keep my classes without annotations.

Thank you

If I understand correctly, Class> abstractSyntaxTree is being injected into its class, but you use ParserGeneratingAST by AbstractSyntaxTree . Although I am not an expert in Pico Container, I think that in this case you can use the factory which creates the AbstractSyntaxTree object (using ParserGeneratingAST ), and Then you can use

Comments