mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Fix mismatch in types of Predicates being used
We're going to need to switch away from Guava's Functions and Predicates for everything and replace them with the java.util versions. Unfortunately there does not appear to be an automated tool to do this all at once. Refaster got close but doesn't seem to care about these particular types of mismatch (I suspect we're using a different version of the JDK than the outside world; ours is OK with Guava classes). This also bumps up Guava to 0.23, which is needed for some new functionality used in combination with Java 8 features. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=170531539
This commit is contained in:
parent
447b83f7db
commit
a50ef39c04
9 changed files with 80 additions and 68 deletions
|
@ -14,11 +14,10 @@
|
|||
|
||||
package google.registry.export;
|
||||
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
|
||||
import static google.registry.model.EntityClasses.CLASS_TO_KIND_FUNCTION;
|
||||
import static google.registry.util.TypeUtils.hasAnnotation;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Ordering;
|
||||
import google.registry.model.EntityClasses;
|
||||
|
@ -33,19 +32,21 @@ public final class ExportConstants {
|
|||
public static ImmutableSet<String> getBackupKinds() {
|
||||
// Back up all entity classes that aren't annotated with @VirtualEntity (never even persisted
|
||||
// to Datastore, so they can't be backed up) or @NotBackedUp (intentionally omitted).
|
||||
return FluentIterable.from(EntityClasses.ALL_CLASSES)
|
||||
.filter(not(hasAnnotation(VirtualEntity.class)))
|
||||
.filter(not(hasAnnotation(NotBackedUp.class)))
|
||||
.transform(CLASS_TO_KIND_FUNCTION)
|
||||
.toSortedSet(Ordering.natural());
|
||||
return EntityClasses.ALL_CLASSES
|
||||
.stream()
|
||||
.filter(hasAnnotation(VirtualEntity.class).negate())
|
||||
.filter(hasAnnotation(NotBackedUp.class).negate())
|
||||
.map(CLASS_TO_KIND_FUNCTION)
|
||||
.collect(toImmutableSortedSet(Ordering.natural()));
|
||||
}
|
||||
|
||||
/** Returns the names of kinds to import into reporting tools (e.g. BigQuery). */
|
||||
public static ImmutableSet<String> getReportingKinds() {
|
||||
return FluentIterable.from(EntityClasses.ALL_CLASSES)
|
||||
return EntityClasses.ALL_CLASSES
|
||||
.stream()
|
||||
.filter(hasAnnotation(ReportedOn.class))
|
||||
.filter(not(hasAnnotation(VirtualEntity.class)))
|
||||
.transform(CLASS_TO_KIND_FUNCTION)
|
||||
.toSortedSet(Ordering.natural());
|
||||
.filter(hasAnnotation(VirtualEntity.class).negate())
|
||||
.map(CLASS_TO_KIND_FUNCTION)
|
||||
.collect(toImmutableSortedSet(Ordering.natural()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue