Top "Factory-pattern" questions

This tag is sometimes used to refer to the Factory Method pattern ([factory-method]) and sometimes used to refer to the Abstract Factory pattern ([abstract-factory]). Please use either of those tags instead of this one.

Annotation based ServiceLocatorFactoryBean?

I would like to implement Factory pattern in my project..i have gone through online resources and I came to …

java spring spring-mvc annotations factory-pattern
Using Reflection in factory pattern

Is it a good practice to use Reflection in Factory pattern? public class MyObjectFactory{ private Party party; public Party getObject(…

java reflection factory factory-pattern
Factory design pattern - Not use static methods because unit testing is a problem

I know this question has been asked several times in stackoverflow but somehow still had some trouble figuring out a …

java design-patterns junit factory-pattern
Hiding classes in a jar file

Is it really impossible to hide some classes in a jar file? I wanted not to allow direct instantiation of …

java jar factory-pattern information-hiding facade
Autofac delegate factory using func<>

I am trying to understand the delegate factory pattern with Autofac. I know how to implement factory using IIndex<&…

delegates autofac factory-pattern
Why should the getInstance() method in Factory pattern be static?

In most of the factory pattern implementations, the getInstance method is usually declared as static. The main advantage of factory …

java factory-pattern
Python, doing conditional imports the right way

Right now I have a class called A. I have some code like this.. from my.package.location.A import …

python import conditional factory-pattern
python 3: class "template" (function that returns a parameterized class)

I am trying to create a function that is passed a parameter x and returns a new class C. C …

python python-3.x class-design factory-pattern
Using Factory with Strategy design pattern

Okay, so I have been given an assignment where I am asked to use both the Strategy and Factory design …

design-patterns uml factory-pattern strategy-pattern
Am I implementing a generics-based Java factory correctly?

I don't believe I am implementing the factory pattern correctly because the Application class' createDocument method accepts any class type, …

java generics factory-pattern