entityBuilder.setKey(datastoreKey); for (Entry<String, ByteIterator> val : values.entrySet()) { entityBuilder.getMutableProperties() .put(val.getKey(), Value.newBuilder()
/** * <pre> * The entity's properties. * The map's keys are property names. * A property name matching regex `__.*__` is reserved. * A reserved property name is forbidden in certain documented contexts. * The name must not contain more than 500 characters. * The name cannot be `""`. * </pre> * * <code>map<string, .google.datastore.v1.Value> properties = 3;</code> */ public Builder putProperties( java.lang.String key, com.google.datastore.v1.Value value) { if (key == null) { throw new java.lang.NullPointerException(); } if (value == null) { throw new java.lang.NullPointerException(); } getMutableProperties().put(key, value); return this; } /**
/** * <pre> * The entity's properties. * The map's keys are property names. * A property name matching regex `__.*__` is reserved. * A reserved property name is forbidden in certain documented contexts. * The name must not contain more than 500 characters. * The name cannot be `""`. * </pre> * * <code>map<string, .google.datastore.v1.Value> properties = 3;</code> */ public Builder removeProperties( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } getMutableProperties().remove(key); return this; } /**
entityBuilder.getMutableProperties().put( "question", Value.newBuilder().setStringValue("Meaning of Life?").build()); entityBuilder.getMutableProperties().put( "answer", Value.newBuilder().setIntegerValue(42).build());
.getMutableProperties() .put(columnName, columnToValue(column, columnValue)); .getMutableProperties() .put("cause", Value.newBuilder().setStringValue(e.getMessage()).build()); .getMutableProperties() .put( "row",
/** * <pre> * The entity's properties. * The map's keys are property names. * A property name matching regex `__.*__` is reserved. * A reserved property name is forbidden in certain documented contexts. * The name must not contain more than 500 characters. * The name cannot be `""`. * </pre> * * <code>map<string, .google.datastore.v1.Value> properties = 3;</code> */ public Builder putAllProperties( java.util.Map<java.lang.String, com.google.datastore.v1.Value> values) { getMutableProperties().putAll(values); return this; } public final Builder setUnknownFields(
/** * Creates a new {@code Entity}. * * @return an immutable entity. */ public Entity build() { entity.getMutableProperties().clear(); entity.putAllProperties( properties .entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, e -> e.getValue().getPb().toBuilder().build()))); return new Entity(entity.build()); }
/** * Add a greeting to the specified guestbook. */ private void addGreeting(String guestbookName, String user, String message) throws DatastoreException { Entity.Builder greeting = Entity.newBuilder(); greeting.setKey(makeKey(GUESTBOOK_KIND, guestbookName, GREETING_KIND)); greeting.getMutableProperties().put(USER_PROPERTY, makeValue(user).build()); greeting.getMutableProperties().put(MESSAGE_PROPERTY, makeValue(message).build()); greeting.getMutableProperties().put(DATE_PROPERTY, makeValue(new Date()).build()); Key greetingKey = insert(greeting.build()); System.out.println("greeting key is: " + greetingKey); }
public Builder clearProperties() { getMutableProperties().clear(); return this; } /**