本文整理汇总了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);
}