本文整理了Java中com.googlecode.objectify.Key.getId()
方法的一些代码示例,展示了Key.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Key.getId()
方法的具体详情如下:
包路径:com.googlecode.objectify.Key
类名称:Key
方法名:getId
暂无
代码示例来源:origin: com.threewks.thundr/thundr-gae
@Override
public Long from(Key<E> from) {
return from.getId();
}
};
代码示例来源:origin: com.threewks.thundr/thundr-gae
@Override
public Long from(Key from) {
return from == null ? null : from.getId();
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
@Override
protected Map<S, T> wrap(Map<Key<T>, T> base) throws Exception
{
Map<S, T> result = new LinkedHashMap<S, T>(base.size() * 2);
for (Map.Entry<Key<T>, T> entry: base.entrySet())
{
Object mapKey = entry.getKey().getName() != null ? entry.getKey().getName() : entry.getKey().getId();
result.put((S)mapKey, entry.getValue());
}
return result;
}
};
代码示例来源:origin: com.googlecode.cedar-common/objectify
/**
* Allocates a single id from the allocator for the specified kind. Safe to use in concert
* with the automatic generator. This is just a convenience method for allocateIds().
*
* @param clazz must be a registered entity class with a Long or long id field.
*/
public <T> long allocateId(Class<T> clazz)
{
return allocateIds(clazz, 1).iterator().next().getId();
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
/**
* Allocates a single id from the allocator for the specified kind. Safe to use in concert
* with the automatic generator. This is just a convenience method for allocateIds().
*
* Note that the id is only unique within the parent, not across the entire kind.
*
* @param parentKeyOrEntity must be a legitimate parent for the class type. It need not
* point to an existent entity, but it must be the correct type for clazz.
* @param clazz must be a registered entity class with a Long or long id field, and
* a parent key of the correct type.
*/
public <T> long allocateId(Object parentKeyOrEntity, Class<T> clazz)
{
return allocateIds(parentKeyOrEntity, clazz, 1).iterator().next().getId();
}
内容来源于网络,如有侵权,请联系作者删除!