本文整理汇总了Java中com.google.appengine.api.datastore.Entity.hasProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.hasProperty方法的具体用法?Java Entity.hasProperty怎么用?Java Entity.hasProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.appengine.api.datastore.Entity
的用法示例。
在下文中一共展示了Entity.hasProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertEntity
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
@Nullable private Record convertEntity(@Nullable Entity e) {
if (e == null) {
return null;
} else if (e.hasProperty(REFRESH_TOKEN_PROPERTY)) {
return new Record(
new StableUserId(
DatastoreUtil.getExistingProperty(e, STABLE_USER_ID_PROPERTY, String.class)),
ParticipantId.ofUnsafe(
DatastoreUtil.getExistingProperty(e, USER_EMAIL_PROPERTY, String.class)),
new OAuthCredentials(
DatastoreUtil.getExistingProperty(e, REFRESH_TOKEN_PROPERTY, String.class),
DatastoreUtil.getExistingProperty(e, ACCESS_TOKEN_PROPERTY, String.class)));
} else {
return new Record(
new StableUserId(
DatastoreUtil.getExistingProperty(e, STABLE_USER_ID_PROPERTY, String.class)),
ParticipantId.ofUnsafe(
DatastoreUtil.getExistingProperty(e, USER_EMAIL_PROPERTY, String.class)),
null);
}
}
示例2: postDelete
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
/**
* To delete an entity with oversized properties, fetch the entity you want to
* delete, delete it and commit the transaction, then pass the entity into
* postDelete().
*/
public void postDelete(Entity entity) {
Preconditions.checkNotNull(entity, "Null entity");
for (MovableProperty property : properties) {
if (entity.hasProperty(property.getMovedPropertyName())) {
BlobKey blobKey = new BlobKey(
(String) entity.getProperty(property.getMovedPropertyName()));
BlobstoreServiceFactory.getBlobstoreService().delete(blobKey);
log.info("Deleted blob for " + property + ": " + blobKey);
listener.blobDeleted(entity.getKey(), property, blobKey);
}
}
}