Skip to content

Commit

Permalink
Merge pull request #10 from izumin5210/bugfix
Browse files Browse the repository at this point in the history
Fix bug
  • Loading branch information
Masayuki IZUMI committed Nov 23, 2015
2 parents 423bc29 + aed7eb0 commit 46c4033
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private CodeBlock createCodeBlock() {
.addStatement(storeModel.getStateName() + " result = null");

for (DispatchableModel dispatchableModel : reducerModel.getDispatchableModels()) {
builder = builder.beginControlFlow("if (actionClass.isAssignableFrom($T.class))", dispatchableModel.getAction());
builder = builder.beginControlFlow("if ($T.class.isAssignableFrom(actionClass))", dispatchableModel.getAction());

String stateGetter = storeModel.isUndoable() ? "getState().clone()" : "getState()";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static class Counter {
" protected void dispatchToReducer(Action action) {",
" Class<? extends Action> actionClass = action.getClass();",
" Counter result = null;",
" if (actionClass.isAssignableFrom(IncrementCountAction.class)) {",
" if (IncrementCountAction.class.isAssignableFrom(actionClass)) {",
" result = counterReducer.onIncrement(getState(), (IncrementCountAction) action);",
" }",
" if (result != null) {",
Expand Down Expand Up @@ -133,7 +133,7 @@ public static class CounterTakesOnlyStateArgument {
" protected void dispatchToReducer(Action action) {",
" Class<? extends Action> actionClass = action.getClass();",
" Counter result = null;",
" if (actionClass.isAssignableFrom(IncrementCountAction.class)) {",
" if (IncrementCountAction.class.isAssignableFrom(actionClass)) {",
" result = counterReducer.onIncrement(getState());",
" }",
" if (result != null) {",
Expand Down Expand Up @@ -225,10 +225,10 @@ public static class TodoList {
" protected void dispatchToReducer(Action action) {",
" Class<? extends Action> actionClass = action.getClass();",
" TodoList result = null;",
" if (actionClass.isAssignableFrom(AddTodoItemAction.class)) {",
" if (AddTodoItemAction.class.isAssignableFrom(actionClass)) {",
" result = todoListReducer.onAddItem(getState(), (AddTodoItemAction) action);",
" }",
" if (actionClass.isAssignableFrom(CompleteTodoItemAction.class)) {",
" if (CompleteTodoItemAction.class.isAssignableFrom(actionClass)) {",
" result = todoListReducer.onCompleteItem(getState(), (CompleteTodoItemAction) action);",
" }",
" if (result != null) {",
Expand Down Expand Up @@ -423,11 +423,11 @@ public static class UndoableTodoList {
" protected void dispatchToReducer(Action action) {",
" Class<? extends Action> actionClass = action.getClass();",
" TodoList result = null;",
" if (actionClass.isAssignableFrom(AddTodoItemAction.class)) {",
" if (AddTodoItemAction.class.isAssignableFrom(actionClass)) {",
" result = undoableTodoListReducer.onAddItem(getState().clone(), (AddTodoItemAction) action);",
" history.insert(result);",
" }",
" if (actionClass.isAssignableFrom(CompleteTodoItemAction.class)) {",
" if (CompleteTodoItemAction.class.isAssignableFrom(actionClass)) {",
" result = undoableTodoListReducer.onCompleteItem(getState().clone(), (CompleteTodoItemAction) action);",
" history.insert(result);",
" }",
Expand Down

0 comments on commit 46c4033

Please sign in to comment.