-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use AutoValue class as @CombinedState in example project
- Loading branch information
Showing
4 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
example/src/main/java/com/yheriatovych/reductor/example/MyAdapterFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.yheriatovych.reductor.example; | ||
|
||
import com.google.gson.TypeAdapterFactory; | ||
import com.ryanharter.auto.value.gson.GsonTypeAdapterFactory; | ||
|
||
@GsonTypeAdapterFactory | ||
public abstract class MyAdapterFactory implements TypeAdapterFactory { | ||
public static TypeAdapterFactory create() { | ||
return new AutoValueGson_MyAdapterFactory(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 11 additions & 3 deletions
14
example/src/main/java/com/yheriatovych/reductor/example/model/AppState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
package com.yheriatovych.reductor.example.model; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import com.google.gson.Gson; | ||
import com.google.gson.TypeAdapter; | ||
import com.yheriatovych.reductor.annotations.CombinedState; | ||
|
||
import java.util.List; | ||
|
||
@CombinedState | ||
public interface AppState { | ||
List<Note> notes(); | ||
@AutoValue | ||
public abstract class AppState { | ||
public abstract List<Note> notes(); | ||
|
||
NotesFilter filter(); | ||
public abstract NotesFilter filter(); | ||
|
||
public static TypeAdapter<AppState> typeAdapter(Gson gson) { | ||
return new AutoValue_AppState.GsonTypeAdapter(gson); | ||
} | ||
} |