本文整理匯總了Java中com.googlecode.objectify.Key.create方法的典型用法代碼示例。如果您正苦於以下問題:Java Key.create方法的具體用法?Java Key.create怎麽用?Java Key.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.googlecode.objectify.Key
的用法示例。
在下文中一共展示了Key.create方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldTransform
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
@Test
public void shouldTransform() {
Key<StringTestEntity> key = Key.create(StringTestEntity.class, "dcba");
Key<StringTestEntity> childKey = Key.create(key, StringTestEntity.class, "abcd");
Key<LongTestEntity> key2 = Key.create(LongTestEntity.class, 4321);
Key<LongTestEntity> childKey2 = Key.create(key, LongTestEntity.class, 1234);
assertThat(transformer.from(key), is(key.getString()));
assertThat(transformer.from(childKey), is(childKey.getString()));
assertThat(transformer.from(key2), is(key2.getString()));
assertThat(transformer.from(childKey2), is(childKey2.getString()));
}
示例2: shouldTransform
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
@Test
public void shouldTransform() {
Key<LongTestEntity> key = Key.create(LongTestEntity.class, 4321L);
Key<LongTestEntity> childKey = Key.create(key, LongTestEntity.class, 1234L);
assertThat(transformer.from(key), is(4321L));
assertThat(transformer.from(childKey), is(1234L));
}
示例3: loadByWebsafeKey
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
public E loadByWebsafeKey(String websafeKey) {
Key<E> key = Key.create(websafeKey);
return loadInternal(key);
}
示例4: fromUuid
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
static <E> ETransformer<UUID, Key<E>> fromUuid(final Class<E> type) {
return from -> Key.create(type, from.toString());
}
示例5: fromString
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
static <E> ETransformer<String, Key<E>> fromString(final Class<E> type) {
return from -> Key.create(type, from);
}
示例6: fromLong
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
static <E> ETransformer<Long, Key<E>> fromLong(final Class<E> type) {
return from -> Key.create(type, from);
}
示例7: fromWebSafeKey
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
protected Key<E> fromWebSafeKey(String key) {
Key<E> k = Key.create(key);
return k;
}
示例8: key
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
protected Key<E> key(E entity) {
return Key.create(entity);
}
示例9: key
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
public static <T> Key<T> key(T instance) {
return instance == null ? null : Key.create(instance);
}
示例10: getKey
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
public Key<MulticastMessage> getKey() {
return Key.create(MulticastMessage.class, id);
}
示例11: remove
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
public static void remove(String currentUser, Long id) {
Key<User> user = Key.create(User.class, currentUser);
Key<SessionData> session = Key.create(user, SessionData.class, id);
ofy().delete().key(session).now();
}
示例12: getKey
import com.googlecode.objectify.Key; //導入方法依賴的package包/類
/**
* Get a key for the given entity.
*
* @param entity The entity.
* @return Entity key.
*/
@Nonnull
default Key<E> getKey(E entity) {
return Key.create(entity);
}