-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
denis-itskovich
committed
Apr 10, 2019
1 parent
03c9db2
commit 1c53bc0
Showing
21 changed files
with
121 additions
and
33 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
15 changes: 14 additions & 1 deletion
15
rxrepo-apt/src/main/java/com/slimgears/rxrepo/apt/FiltersExtension.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,16 +1,29 @@ | ||
package com.slimgears.rxrepo.apt; | ||
|
||
import com.google.auto.service.AutoService; | ||
import com.slimgears.apt.data.TypeInfo; | ||
import com.slimgears.util.autovalue.apt.Context; | ||
import com.slimgears.util.autovalue.apt.PropertyInfo; | ||
import com.slimgears.util.autovalue.apt.extensions.Extension; | ||
|
||
import javax.annotation.processing.SupportedAnnotationTypes; | ||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
|
||
@AutoService(Extension.class) | ||
@SupportedAnnotationTypes("com.slimgears.rxrepo.annotations.UseFilters") | ||
public class FiltersExtension implements Extension { | ||
@Override | ||
public String generateClassBody(Context context) { | ||
return context.evaluateResource("filter-body.java.vm"); | ||
Collection<PropertyInfo> filterableProperties = context.properties() | ||
.stream() | ||
.filter(p -> p.annotations() | ||
.stream() | ||
.anyMatch(a -> a.type().equals(TypeInfo.of("com.slimgears.rxrepo.annotations.Filterable")))) | ||
.collect(Collectors.toList()); | ||
|
||
return context.evaluatorForResource("filter-body.java.vm") | ||
.variable("filterableProperties", filterableProperties) | ||
.evaluate(); | ||
} | ||
} |
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
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
10 changes: 7 additions & 3 deletions
10
rxrepo-apt/src/test/java/com/slimgears/rxrepo/queries/TestEntityPrototype.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,18 +1,22 @@ | ||
package com.slimgears.rxrepo.queries; | ||
|
||
import com.slimgears.rxrepo.annotations.Filterable; | ||
import com.slimgears.rxrepo.annotations.Indexable; | ||
import com.slimgears.rxrepo.annotations.UseFilters; | ||
import com.slimgears.util.autovalue.annotations.AutoValuePrototype; | ||
import com.slimgears.util.autovalue.annotations.Key; | ||
import com.slimgears.util.autovalue.annotations.Reference; | ||
import com.slimgears.util.autovalue.annotations.UseCopyAnnotator; | ||
|
||
import java.util.Collection; | ||
|
||
@AutoValuePrototype | ||
@UseFilters | ||
@UseCopyAnnotator | ||
public interface TestEntityPrototype { | ||
@Key TestKey key(); | ||
String text(); | ||
int number(); | ||
@Reference TestRefEntity refEntity(); | ||
@Indexable @Filterable String text(); | ||
@Indexable @Filterable int number(); | ||
@Reference @Filterable TestRefEntity refEntity(); | ||
Collection<TestRefEntity> refEntities(); | ||
} |
5 changes: 3 additions & 2 deletions
5
rxrepo-apt/src/test/java/com/slimgears/rxrepo/queries/TestRefEntityPrototype.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,13 @@ | ||
package com.slimgears.rxrepo.queries; | ||
|
||
import com.slimgears.rxrepo.annotations.Filterable; | ||
import com.slimgears.rxrepo.annotations.UseFilters; | ||
import com.slimgears.util.autovalue.annotations.AutoValuePrototype; | ||
import com.slimgears.util.autovalue.annotations.Key; | ||
|
||
@AutoValuePrototype | ||
@UseFilters | ||
public interface TestRefEntityPrototype { | ||
@Key int id(); | ||
String text(); | ||
@Filterable @Key int id(); | ||
@Filterable String text(); | ||
} |
11 changes: 11 additions & 0 deletions
11
rxrepo-core/src/main/java/com/slimgears/rxrepo/annotations/Filterable.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.slimgears.rxrepo.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface Filterable { | ||
} |
11 changes: 11 additions & 0 deletions
11
rxrepo-core/src/main/java/com/slimgears/rxrepo/annotations/Indexable.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.slimgears.rxrepo.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface Indexable { | ||
} |
11 changes: 11 additions & 0 deletions
11
rxrepo-core/src/main/java/com/slimgears/rxrepo/annotations/Searchable.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.slimgears.rxrepo.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface Searchable { | ||
} |
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
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
1 change: 1 addition & 0 deletions
1
rxrepo-core/src/main/java/com/slimgears/rxrepo/expressions/PropertyExpression.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
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
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
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
7 changes: 6 additions & 1 deletion
7
rxrepo-core/src/main/java/com/slimgears/rxrepo/filters/Filters.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
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
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
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
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
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