本文整理了Java中com.google.appengine.api.datastore.Entity.getProperty()
方法的一些代码示例,展示了Entity.getProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getProperty()
方法的具体详情如下:
包路径:com.google.appengine.api.datastore.Entity
类名称:Entity
方法名:getProperty
暂无
代码示例来源:origin: org.vesalainen.dsql/dsql
@Override
public Object getValue()
{
return entity.getProperty(property);
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
protected static <E> List<E> getListProperty(String propertyName, Entity entity) {
@SuppressWarnings("unchecked")
List<E> list = (List<E>) entity.getProperty(propertyName);
return list == null ? new LinkedList<E>() : list;
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public Slot(Entity entity, boolean lazy) {
super(entity);
filled = (Boolean) entity.getProperty(FILLED_PROPERTY);
fillTime = (Date) entity.getProperty(FILL_TIME_PROPERTY);
sourceJobKey = (Key) entity.getProperty(SOURCE_JOB_KEY_PROPERTY);
waitingOnMeKeys = getListProperty(WAITING_ON_ME_PROPERTY, entity);
if (lazy) {
serializedVersion = entity.getProperty(VALUE_PROPERTY);
} else {
value = deserializeValue(entity.getProperty(VALUE_PROPERTY));
}
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public ShardedValue(Entity entity) {
super(entity);
this.shardId = (Long) entity.getProperty(SHARD_ID_PROPERTY);
this.value = ((Blob) entity.getProperty(VALUE_PROPERTY)).getBytes();
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
@Override
public Set<String> call() {
Set<String> pipelines = new LinkedHashSet<>();
for (Entity entity : preparedQuery.asIterable()) {
pipelines.add((String) entity.getProperty(JobRecord.ROOT_JOB_DISPLAY_NAME));
}
return pipelines;
}
});
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public FanoutTaskRecord(Entity entity) {
super(entity);
Blob payloadBlob = (Blob) entity.getProperty(PAYLOAD_PROPERTY);
payload = payloadBlob.getBytes();
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public Barrier(Entity entity) {
super(entity);
jobKey = (Key) entity.getProperty(JOB_KEY_PROPERTY);
type = Type.valueOf((String) entity.getProperty(TYPE_PROPERTY));
released = (Boolean) entity.getProperty(RELEASED_PROPERTY);
waitingOnKeys = getListProperty(WAITING_ON_KEYS_PROPERTY, entity);
waitingOnGroupSizes = getListProperty(WAITING_ON_GROUP_SIZES_PROPERTY, entity);
}
代码示例来源:origin: GoogleCloudPlatform/appengine-gcs-client
private GcsFileMetadata createGcsFileMetadataFromBlobstore(Entity entity, GcsFilename filename) {
return new GcsFileMetadata(
filename,
GcsFileOptions.getDefaultInstance(),
"",
(Long) entity.getProperty("size"),
(Date) entity.getProperty("creation"));
}
代码示例来源:origin: com.google.appengine.orm/datanucleus-appengine
static public void copyProperties(Entity src, Entity dest) {
for (Map.Entry<String, Object> entry : getPropertyMap(src).entrySet()) {
// barf
if (entry.getValue() != null &&
entry.getValue().getClass().getName().equals("com.google.appengine.api.datastore.Entity$UnindexedValue")) {
dest.setUnindexedProperty(entry.getKey(), src.getProperty(entry.getKey()));
} else {
dest.setProperty(entry.getKey(), entry.getValue());
}
}
}
代码示例来源:origin: org.eiichiro.acidhouse/acidhouse-appengine
/**
* Translates Google App Engine Datastore entity to Acid House {@code Lock}
* entity.
*
* @param entity oogle App Engine Datastore entity.
* @return Acid House {@code Lock} entity.
*/
public static Lock toLock(Entity entity) {
return new Lock(entity.getKey().getName(),
(String) entity.getProperty(TRANSACTION_PROPERTY),
(Date) entity.getProperty(TIMESTAMP_PROPERTY));
}
代码示例来源:origin: com.google.http-client/google-http-client-appengine
/** Deserializes the specified object from a Blob using an {@link ObjectInputStream}. */
private V deserialize(Entity entity) throws IOException {
Blob blob = (Blob) entity.getProperty(FIELD_VALUE);
return IOUtils.deserialize(blob.getBytes());
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public ExceptionRecord(Entity entity) {
super(entity);
Blob serializedExceptionBlob = (Blob) entity.getProperty(EXCEPTION_PROPERTY);
byte[] serializedException = serializedExceptionBlob.getBytes();
try {
exception = (Throwable) SerializationUtils.deserialize(serializedException);
} catch (IOException e) {
throw new RuntimeException("Failed to deserialize exception for " + getKey(), e);
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public Entity update(Entity blockEntity, int recordOffset, @Nullable FieldValue fieldValue) {
Blob strings = (Blob) blockEntity.getProperty("ids");
int length = StringPools.size(strings);
// since we only ever update when adding a new record, we should be able to simply append to the string pool
if(recordOffset != length) {
throw new IllegalStateException("length = " + length + ", recordOffset = " + recordOffset);
}
blockEntity.setProperty("ids", StringPools.appendString(strings, ((TextValue) fieldValue).asString()));
return blockEntity;
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
private String getServerHostAndPort() throws EntityNotFoundException {
String serverName = (String) getTestDataEntity().getProperty("serverName");
long serverPort = (Long) getTestDataEntity().getProperty("serverPort");
return serverName + (serverPort == 80 ? "" : (":" + serverPort));
}
代码示例来源:origin: PeterKnego/LeanEngine-Server
public static JsonNode entityToJson(Entity entity) throws LeanException {
ObjectNode json = getObjectMapper().createObjectNode();
json.put("_id", entity.getKey().getId());
json.putPOJO("_kind", entity.getKind());
json.putPOJO("_account", entity.getProperty("_account"));
Map<String, Object> props = entity.getProperties();
for (Map.Entry<String, Object> prop : props.entrySet()) {
addTypedNode(json, prop.getKey(), prop.getValue());
}
return json;
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
@InSequence(2)
public void testStep2BigAsList() {
Query q = new Query(kindName, rootKey);
q.addSort("count", Query.SortDirection.DESCENDING);
List<Entity> eData = service.prepare(q).asList(fo);
assertEquals(bigCount, eData.size());
assertEquals(new Integer(bigCount - 1).longValue(), eData.get(0).getProperty("count"));
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
public void testSortPredicates() {
Query query = new Query(kindName, rootKey);
query.addSort("intData", Query.SortDirection.DESCENDING);
List<Entity> es = service.prepare(query).asList(fo);
assertEquals((long) 40, es.get(0).getProperty("intData"));
List<Query.SortPredicate> qsp = query.getSortPredicates();
assertEquals("check SortPredicate name", "intData", qsp.get(0).getPropertyName());
assertEquals("check SortPredicate direction", Query.SortDirection.DESCENDING, qsp.get(0).getDirection());
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
public void testAllowMultipleGroupTrue() throws Exception {
clearData(kindName);
clearData(otherKind);
writeMultipleGroup(true);
Query q = new Query(kindName);
Entity e = service.prepare(q).asSingleEntity();
assertEquals("parent", e.getProperty("check"));
q = new Query(otherKind);
e = service.prepare(q).asSingleEntity();
assertEquals("other", e.getProperty("check"));
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
private void checkCount(String statsKind) {
FetchOptions fo = FetchOptions.Builder.withDefaults();
Query query = new Query(statsKind);
assertTrue(service.prepare(query).countEntities(fo) > 0);
for (Entity readRec : service.prepare(query).asIterable()) {
assertTrue((Long) readRec.getProperty("count") > 0);
}
}
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
public void testNullPropertyValue() throws Exception {
Key parentKey = createQueryBasicsTestParent("testNullPropertyValue");
createEntity("Entry", parentKey)
.withProperty("user", null)
.store();
Entity entity = service.prepare(new Query("Entry")
.setAncestor(parentKey)).asSingleEntity();
assertNull(entity.getProperty("user"));
}
内容来源于网络,如有侵权,请联系作者删除!