|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.latexdraw.glib.views.CreateViewCmd<M,V,F>
M
- The type of the model used to create the view.V
- The type of the view to create.F
- The type of the next command.public abstract class CreateViewCmd<M,V,F extends CreateViewCmd<M,V,F>>
Defines a generic command mixed with a chain of responsibility.
The goal is to tame the cyclomatic complexity of factories by linking
the commands together. If a command cannot create the view using the given objects,
the next command is called.
this class has three generics: the first one define the model of the view; the
second one the view; the third one is the type of the next element of the chain of
responsibility.
This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
11/25/11
Field Summary | |
---|---|
protected java.lang.Class<? extends M> |
clazz
The type of the model supported by the command. |
protected F |
next
The next command. |
Constructor Summary | |
---|---|
CreateViewCmd(F next,
java.lang.Class<? extends M> clazz)
Creates the command. |
Method Summary | |
---|---|
protected abstract V |
create(M model)
Creates an instance of the view corresponding to the given shape. |
V |
execute(M model)
Launches the creation process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected F extends CreateViewCmd<M,V,F> next
protected java.lang.Class<? extends M> clazz
Constructor Detail |
---|
public CreateViewCmd(F next, java.lang.Class<? extends M> clazz)
next
- The next command in the chain of responsibility. Can be null.clazz
- The class of the model.Method Detail |
---|
public V execute(M model)
model
- The model used to create the view.
protected abstract V create(M model)
model
- The model used to create the view.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |