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