Refine search
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
result = result && (getMeaning() == other.getMeaning()); result = result && (getExcludeFromIndexes() == other.getExcludeFromIndexes()); result = result && getValueTypeCase().equals(other.getValueTypeCase()); if (!result) return false; switch (valueTypeCase_) { case 11: result = result && getNullValueValue() == other.getNullValueValue(); break; case 1: result = result && (getBooleanValue() == other.getBooleanValue()); break; case 2: result = result && (getIntegerValue() == other.getIntegerValue()); break; case 3: result = result && (java.lang.Double.doubleToLongBits(getDoubleValue()) == java.lang.Double.doubleToLongBits(other.getDoubleValue())); break; case 10: result = result && getTimestampValue().equals(other.getTimestampValue()); break; case 5: result = result && getKeyValue().equals(other.getKeyValue()); break; case 17: result = result && getStringValue().equals(other.getStringValue()); break;
if (valueBuilder_ == null) { if (parameterTypeCase_ == 2 && parameterType_ != com.google.datastore.v1.Value.getDefaultInstance()) { parameterType_ = com.google.datastore.v1.Value.newBuilder( (com.google.datastore.v1.Value) parameterType_) .mergeFrom(value) .buildPartial(); } else { parameterType_ = value;
/** * @return the timestamp in microseconds contained in value * @throws IllegalArgumentException if the value does not contain a timestamp. */ public static long getTimestamp(Value value) { if (value.getMeaning() == 18 && value.getValueTypeCase() == ValueTypeCase.INTEGER_VALUE) { return value.getIntegerValue(); } else if (value.getValueTypeCase() == ValueTypeCase.TIMESTAMP_VALUE) { return toMicroseconds(value.getTimestampValue()); } throw new IllegalArgumentException("Value does not contain a timestamp."); }
@Override public String toString() { switch (value.getValueTypeCase()) { case KEY_VALUE: return getKey().toString(); case STRING_VALUE: return value.getStringValue(); case BLOB_VALUE: return "<binary>"; return getDate().toString(); case INTEGER_VALUE: return String.valueOf(value.getIntegerValue()); case DOUBLE_VALUE: return String.valueOf(value.getDoubleValue()); case BOOLEAN_VALUE: return String.valueOf(value.getBooleanValue()); case ENTITY_VALUE: return getEntity().toString(); return "<null>"; default: return value.toString();
/** * Grabs the schema for what data is in the Entity. * @param entity a populated entity * @return a schema of what kind of data is in the entity */ private JsonObject entitySchema(Entity entity) { JsonObject jsonObject = new JsonObject(); entity.getPropertiesMap().entrySet().stream().forEach(entrySet -> { String key = entrySet.getKey(); Value value = entrySet.getValue(); switch (value.getValueTypeCase()) { case ENTITY_VALUE: jsonObject.add(key, entitySchema(value.getEntityValue())); break; case ARRAY_VALUE: jsonObject.add(key, arraySchema(value.getArrayValue())); break; default: jsonObject.addProperty(key, value.getValueTypeCase().toString()); } }); return jsonObject; }
Value.newBuilder().setStringValue("Meaning of Life?").build()); Value.newBuilder().setIntegerValue(42).build()); String question = entity.getProperties().get("question").getStringValue(); Long answer = entity.getProperties().get("answer").getIntegerValue(); System.out.println(question); String result = System.console().readLine("> ");
/** * @return the blob contained in value * @throws IllegalArgumentException if the value does not contain a blob. */ public static ByteString getByteString(Value value) { if (value.getMeaning() == 18 && value.getValueTypeCase() == ValueTypeCase.STRING_VALUE) { return value.getStringValueBytes(); } else if (value.getValueTypeCase() == ValueTypeCase.BLOB_VALUE) { return value.getBlobValue(); } throw new IllegalArgumentException("Value does not contain a blob."); }
/** * @return the string contained in value * @throws IllegalArgumentException if the value does not contain a string. */ public static String getString(Value value) { if (value.getValueTypeCase() != ValueTypeCase.STRING_VALUE) { throw new IllegalArgumentException("Value does not contain a string."); } return value.getStringValue(); }
@Override protected String getValue(com.google.datastore.v1.Value from) { return from.getStringValue(); }
/** * @return the entity contained in value * @throws IllegalArgumentException if the value does not contain an entity. */ public static Entity getEntity(Value value) { if (value.getValueTypeCase() != ValueTypeCase.ENTITY_VALUE) { throw new IllegalArgumentException("Value does not contain an Entity."); } return value.getEntityValue(); }
/** * @return the long contained in value * @throws IllegalArgumentException if the value does not contain a long. */ public static long getLong(Value value) { if (value.getValueTypeCase() != ValueTypeCase.INTEGER_VALUE) { throw new IllegalArgumentException("Value does not contain an integer."); } return value.getIntegerValue(); }
static Value<?> fromPb(com.google.datastore.v1.Value proto) { ValueTypeCase descriptorId = proto.getValueTypeCase(); ValueType valueType = ValueType.getByDescriptorId(descriptorId.getNumber()); return valueType == null ? RawValue.MARSHALLER.fromProto(proto).build() : valueType.getMarshaller().fromProto(proto).build(); } }
/** * @return the array contained in value as a list. * @throws IllegalArgumentException if the value does not contain an array. */ public static List<Value> getList(Value value) { if (value.getValueTypeCase() != ValueTypeCase.ARRAY_VALUE) { throw new IllegalArgumentException("Value does not contain an array."); } return value.getArrayValue().getValuesList(); }
/** * @return the key contained in value * @throws IllegalArgumentException if the value does not contain a key. */ public static Key getKey(Value value) { if (value.getValueTypeCase() != ValueTypeCase.KEY_VALUE) { throw new IllegalArgumentException("Value does not contain a key."); } return value.getKeyValue(); }
/** * @return the double contained in value * @throws IllegalArgumentException if the value does not contain a double. */ public static double getDouble(Value value) { if (value.getValueTypeCase() != ValueTypeCase.DOUBLE_VALUE) { throw new IllegalArgumentException("Value does not contain a double."); } return value.getDoubleValue(); }
/** * @return the boolean contained in value * @throws IllegalArgumentException if the value does not contain a boolean. */ public static boolean getBoolean(Value value) { if (value.getValueTypeCase() != ValueTypeCase.BOOLEAN_VALUE) { throw new IllegalArgumentException("Value does not contain a boolean."); } return value.getBooleanValue(); }
@Override protected Long getValue(com.google.datastore.v1.Value from) { return from.getIntegerValue(); }
@Override protected FullEntity<?> getValue(com.google.datastore.v1.Value from) { return FullEntity.fromPb(from.getEntityValue()); }
@Override protected Timestamp getValue(com.google.datastore.v1.Value from) { return Timestamp.fromProto(from.getTimestampValue()); }