mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Refactor Guava functional methods to use lambdas
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177027488
This commit is contained in:
parent
2ae496bfce
commit
bbe2584da4
47 changed files with 478 additions and 647 deletions
|
@ -15,15 +15,11 @@
|
|||
package google.registry.util;
|
||||
|
||||
import com.google.appengine.api.datastore.Key;
|
||||
import com.google.common.base.Function;
|
||||
import java.util.Optional;
|
||||
|
||||
/** Utility methods for working with the App Engine Datastore service. */
|
||||
public class DatastoreServiceUtils {
|
||||
|
||||
/** Helper function that extracts the kind from a regular Datastore entity key. */
|
||||
public static final Function<Key, String> KEY_TO_KIND_FUNCTION = Key::getKind;
|
||||
|
||||
/** Returns the name or id of a key, which may be a string or a long. */
|
||||
public static Object getNameOrId(Key key) {
|
||||
return Optional.<Object>ofNullable(key.getName()).orElse(key.getId());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue