Skip to content

Commit

Permalink
Merge pull request #34 from izumin5210/fix-processor
Browse files Browse the repository at this point in the history
Fix bugs and upload task
  • Loading branch information
Masayuki IZUMI committed Dec 6, 2015
2 parents c1594c0 + 35807dc commit 27fe148
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ext {
def versionMajor = 0
def versionMinor = 5
def versionPatch = 0
version = "${versionMajor}.${versionMinor}.${versionPatch}"
versionName = "${versionMajor}.${versionMinor}.${versionPatch}"

compileSdkVersion = 23
buildToolsVersion = '23.0.2'
Expand Down
2 changes: 1 addition & 1 deletion droidux-processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ publish {
userOrg = project_bintray_org
groupId = project_group
artifactId = 'droidux-processor'
version = project.version
version = project.versionName
description = 'Code generator for info.izumin.android.droidux'
website = project_url
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public FieldSpec apply(StoreImplModel input) {
private MethodSpec createConstructor() {
MethodSpec.Builder builder = MethodSpec.constructorBuilder()
.addModifiers(Modifier.PROTECTED)
.addParameter(getParameterSpec(storeModel.getBuilderModel().getClassName()));
.addParameter(getParameterSpec(storeModel.getBuilderModel().getClassName(), Modifier.FINAL));

for (StoreImplModel storeImpl : storeModel.getStoreImplModels()) {
builder = builder.addStatement("$N = new $T($N.$N, $N.$N)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.squareup.javapoet.ClassName;

import java.util.List;
import java.util.function.Consumer;

import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
Expand Down Expand Up @@ -74,25 +73,22 @@ public StoreMethodModel apply(ExecutableElement input) {
})
.toList();

FluentIterable.from(storeImplModels)
.forEach(new Consumer<StoreImplModel>() {
@Override
public void accept(final StoreImplModel storeImplModel) {
storeImplModel.setIsBindable(FluentIterable.from(methodModels)
.filter(new Predicate<StoreMethodModel>() {
@Override
public boolean apply(StoreMethodModel input) {
return ClassName.get(input.getReturnType()).equals(storeImplModel.getState());
}
})
.anyMatch(new Predicate<StoreMethodModel>() {
@Override
public boolean apply(StoreMethodModel input) {
return input.isBindable();
}
}));
}
});
for (final StoreImplModel storeImplModel : storeImplModels) {
storeImplModel.setIsBindable(FluentIterable.from(methodModels)
.filter(new Predicate<StoreMethodModel>() {
@Override
public boolean apply(StoreMethodModel input) {
return ClassName.get(input.getReturnType()).equals(storeImplModel.getState());
}
})
.anyMatch(new Predicate<StoreMethodModel>() {
@Override
public boolean apply(StoreMethodModel input) {
return input.isBindable();
}
}));
}

this.builderModel = new BuilderModel(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static class Counter {
" private final DroiduxRootStore_CounterStoreImpl counterStoreImpl;",
" private final Dispatcher dispatcher;",
"",
" protected DroiduxRootStore(Builder builder) {",
" protected DroiduxRootStore(final Builder builder) {",
" counterStoreImpl= new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);",
" dispatcher = new Dispatcher(builder.middlewares, counterStoreImpl);",
" for (Middleware middleware : builder.middlewares) {",
Expand Down Expand Up @@ -211,7 +211,7 @@ public static class BindableCounter {
" private final DroiduxRootStore_CounterStoreImpl counterStoreImpl;",
" private final Dispatcher dispatcher;",
"",
" protected DroiduxRootStore(Builder builder) {",
" protected DroiduxRootStore(final Builder builder) {",
" counterStoreImpl = new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);",
" counterStoreImpl.addListener(new OnStateChangedListener<Counter>() {",
" @Override",
Expand Down Expand Up @@ -322,7 +322,7 @@ public static class CombinedTwoReducers {
" private final DroiduxRootStore_TodoListStoreImpl todoListStoreImpl;",
" private final Dispatcher dispatcher;",
"",
" protected DroiduxRootStore(Builder builder) {",
" protected DroiduxRootStore(final Builder builder) {",
" counterStoreImpl= new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);",
" todoListStoreImpl= new DroiduxRootStore_TodoListStoreImpl(builder.todoList, builder.todoListReducer);",
" dispatcher = new Dispatcher(builder.middlewares, counterStoreImpl, todoListStoreImpl);",
Expand Down Expand Up @@ -453,7 +453,7 @@ public static class CombinedReducerAndBindableReducer {
" private final DroiduxRootStore_TodoListStoreImpl todoListStoreImpl;",
" private final Dispatcher dispatcher;",
"",
" protected DroiduxRootStore(Builder builder) {",
" protected DroiduxRootStore(final Builder builder) {",
" counterStoreImpl= new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);",
" todoListStoreImpl= new DroiduxRootStore_TodoListStoreImpl(builder.todoList, builder.todoListReducer);",
" todoListStoreImpl.addListener(new OnStateChangedListener<TodoList>() {",
Expand Down
2 changes: 1 addition & 1 deletion droidux/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ publish {
userOrg = project_bintray_org
groupId = project_group
artifactId = 'droidux'
version = project.version
version = project.versionName
description = '"Predictable state container" implementation, inspired by Redux for JS.'
website = project_url
}

0 comments on commit 27fe148

Please sign in to comment.