code: public Entity javaToDatastore(Key parentKey, Object javaObject) {
  		Key key = keyProperty.getValue(javaObject);
  		Entity entity = key == null? new Entity(kind, parentKey) : new Entity(key); 
  		for (Entry<String, PropertyMetadata<?, ?>> entry : properties.entrySet()) {
  			PropertyMetadata property = entry.getValue();
  			Object javaValue = property.getValue(javaObject);
  			property.setEntityValue(entity, javaValue);
  		}
  		return entity;
  	}
docs: Convert a value from Java representation to a Datastore {@link Entity}
  @param javaObject the Java property value
  @param parentKey the parent {@link Key} (may be null)