I have some Abstract Factory
public interface AbstractViewersFactory {
IAbstractShapeViewer createRectangle(BaseOperationsListener<RectangleDTO> p);
IAbstractShapeViewer createOval(BaseOperationsListener<OvalDTO> p);
IAbstractShapeViewer createTriangle(BaseOperationsListener<TriangleDTO> p);
}
And Its implementation Draw2DViewersFactory.
Now, I want create some class that will take responsibility for creating presenters/viewers by model and configurate it by Spring.
So, I need describe in .xml configuration what method it should call.
It can be something like this (pseudo config)
<bean creator>
<constructor-args>
<list>
<bean describe-item> <constructor-args>model=Rectangle.class, method-for-viewer-create="createRectangle"</args>
<bean describe-item> <constructor-args>model=Oval.class, method-for-viewer-create="createOval"</args>
<list>
</constructor-args>
</bean>
How I can do it?
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…