Short answer is no. You typically only want to use it for services, rather
than data.

Dhanji.

On Sun, Jan 24, 2010 at 2:38 PM, Berlin Brown <[email protected]>wrote:

> This is a general design question.
>
> Should you use Guice dependency injection whenever you use the new
> operator?  Even within methods.
>
> For example, I have an application where I use guice for some of the
> main object creation calls.  But I haven't used it within some of the
> methods
>
> For example, here is a method I was considering guice for:
>
>        final DescriptiveStatistics stats = this.toReportStats
> (this.stringUtils);
>        final DescriptiveStatistics wordSizeStats =
> this.toReportStatsWordSize(this.stringUtils);
>        final ReportDocument noStopWordsReport = this.build(false);
>        final DescriptiveStatistics noStopWordsStats =
> noStopWordsReport.toReportStats(this.stringUtils);
>        final DescriptiveStatistics noStopWordsWordSizeStats =
> noStopWordsReport.toReportStatsWordSize
> (this.stringUtils);
>        final Set<Map.Entry<String, Integer>> topWords = this.topWords
> (this.getNumTopWords(), true, this.stringUtils);
>
>        final ReportStatsDocument statsReport = new ReportStatsDocument
> (
>                this.getDocumentSize(),
>                this.isStopWords(),
>                stats,
>                wordSizeStats,
>                noStopWordsReport,
>                noStopWordsStats,
>                noStopWordsWordSizeStats,
>                topWords);
>        return statsReport;
>
>    }
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to