ComplexMovieListerFactory Class – Spring.Net

using Spring.Objects.Factory;
using System.Collections.Generic;
using System.Collections;
 
namespace MovieFinderTestSpring.Net
{
    public class ComplexMovieListerFactory : IObjectFactoryAware
    {
        private IListableObjectFactory objectFactory;
 
        #region IObjectFactoryAware Members
 
        public IObjectFactory ObjectFactory
        {
            set { objectFactory = (IListableObjectFactory)value; }
        }
 
        #endregion
 
        public MovieLister Build()
        {
            IDictionary allMovies = objectFactory.GetObjectsOfType(typeof(Movie));
            List<Movie> movies = new List<Movie>();
            foreach (DictionaryEntry movie in allMovies)
                movies.Add((Movie)movie.Value);
            ComplexMovieFinder complexMovieFinder = new ComplexMovieFinder();
            complexMovieFinder.Movies = movies;
            MovieLister complexMovieLister = new MovieLister(complexMovieFinder);
            return complexMovieLister;
        }
    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s