factory-pattern Questions
2
Solved
I am using Spring Boot for Java standalone application. I have a bean which makes use of a service. I want to inject different implementations of that service at runtime, based on a property in a p...
Krysta asked 20/10, 2014 at 10:22
2
Solved
In Java, to convert a String to BigInteger you use the constructor new BigInteger(String) but to convert an int/long you use the factory function BigInteger.valueof(long), why is that?
Beneficence asked 3/10, 2014 at 20:24
1
I am making a messenger which can send email messages or sms messages, and has the possibility to send them now or send them later (the information is saved in the DB). I've made 2 solutions, but n...
Gray asked 30/9, 2014 at 9:35
1
Solved
I have the following classes:
CommonService
ClientService
InvoiceService
And I would like to load the correct class with a factory (for DI) based on the url:
CommonService: localhost/service/...
Snell asked 17/9, 2014 at 6:27
1
Below is about a usage of factory constructor from Seth Ladd's blog ' Dart - Trying to understand the value of 'factory' constructor'.
class Symbol {
final String name;
static Map<Str...
Leyes asked 12/9, 2014 at 0:18
2
Solved
In the project I'm working on (not my project, just working on it), there are many structures like this:
project.priv.logic.MyServiceImpl.java
project.priv.service.MyServiceFactoryImpl.java
proje...
Towering asked 5/8, 2014 at 15:17
2
Solved
I was reading about creational design patterns and have managed to utterly confuse myself between Factory , Abstract Factory and Factory method.
I am posting a code snippet below. Would someone b...
Bambino asked 26/5, 2014 at 6:32
2
Solved
I am trying to follow the repository pattern outlined in this article http://code.tutsplus.com/tutorials/the-repository-design-pattern--net-35804#highlighter_174798 And I am trying to instantiate a...
Vesical asked 10/2, 2014 at 15:12
2
I want to create something like an universal factory method - look at this one:
template <class BaseType>
class Factory {
public:
template <class ... Args>
static BaseType* Create(c...
Unexpected asked 28/1, 2014 at 7:53
1
Solved
I have a series of factories that return unique_ptr<Base>. Under the hood, though, they are providing pointers to various derived types, i.e unique_ptr<Derived>, unique_ptr<DerivedA&...
Skindive asked 16/1, 2014 at 22:53
5
Solved
This is the first time I am writing a Factory class. Below is my Factory class, I am not sure whether this is the correct way of making thread safe Singleton Factory class or not. I will be r...
Tesch asked 9/1, 2014 at 23:8
5
Solved
I have seen an implementation of Factory using static methods. Something like this:
public class MyFactory {
public static Product1 createProduct1() {}
public static Product2 createProduct2() {}...
Branch asked 18/4, 2011 at 14:28
3
I want to create the following Strategy Pattern combined with Factory, but I want it to be typesafe. I have done the following till now:
public interface Parser<T> {
public Collection<T...
Prat asked 11/11, 2013 at 14:39
3
Solved
Let's say I want to build a list of strings (Which is not the real scenario case, but sounds simpler to explain).
I'd have an interface for my list of strings factory that would look like this
pu...
Britannia asked 8/10, 2013 at 2:53
4
Solved
lets say i have a service:
namespace Helloworld\Service;
class GreetingService
{
public function getGreeting()
{
if(date("H") <= 11)
return "Good morning, world!";
else if (date("H") >...
Guttersnipe asked 27/1, 2013 at 18:59
1
Solved
in my Module.php i have the fallowing methods that i would like to move them in a factory class so that i wont clutter the Module class:
public function getControllerConfig()
{
return array(
'fa...
Cyrenaic asked 18/9, 2013 at 6:48
3
Solved
Is it a good practice to use Reflection in Factory pattern?
public class MyObjectFactory{
private Party party;
public Party getObject(String fullyqualifiedPath)
{
Class c = Class.forName(f...
Lamm asked 25/8, 2013 at 18:14
1
Solved
I'm accustomed to creating my own factories as shown (this is simplified for illustration):
public class ElementFactory
{
public IElement Create(IHtml dom)
{
switch (dom.ElementType)
{
case "...
Teahan asked 21/8, 2013 at 20:11
6
Solved
I have 2 classes:
public class Articles
{
private string name;
public Articles(string name)
{
this.name = name;
}
public void Output()
{
Console.WriteLine("The class is: " + this.GetType...
Telesthesia asked 5/7, 2013 at 14:20
31
Most of the examples quoted for usage of Dependency Injection, we can solve using the factory pattern as well. Looks like when it comes to usage/design the difference between dependency injec...
Posthumous asked 17/2, 2009 at 17:3
1
Solved
I am trying to understand the delegate factory pattern with Autofac. I know how to implement factory using IIndex<> with Keyed() registration, which is explained nicely in here: Configuring an A...
Anitaanitra asked 14/3, 2013 at 22:29
5
Solved
I have a question about how to make a good design for my program. My program is quite simple but I want to have good architecture and make my program easily extensible in the future.
My prog...
Affable asked 8/2, 2013 at 15:50
4
Solved
I'm new on developing an Abstract Factory pattern, and would like to create an abstract factory in the data layer that will help me link this layer to any other databases for example sql and oracle...
Curettage asked 5/5, 2011 at 13:43
2
Solved
We have a system which we use to charge the customers for different type of charges.
There are multiple charge types and each charge type includes different charge items.
The below is what I ha...
Thunell asked 25/1, 2013 at 16:46
6
Solved
I've been reviewing Java Regex Library, surprised by the fact the Pattern class does not have a public constructor which I've taken for granted for years.
One reason I suspect the static compile m...
Cecilla asked 7/12, 2012 at 7:28
© 2022 - 2024 — McMap. All rights reserved.