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(); } }
result = result && (getMeaning() == other.getMeaning()); result = result && (getExcludeFromIndexes() == other.getExcludeFromIndexes()); result = result && getValueTypeCase().equals(other.getValueTypeCase()); if (!result) return false; switch (valueTypeCase_) {
setExcludeFromIndexes(other.getExcludeFromIndexes()); switch (other.getValueTypeCase()) { case NULL_VALUE:
/** * Check if value is a integer. * * @return {@code true} if value is a integer. */ public boolean isInteger() { return value.getValueTypeCase() == com.google.datastore.v1.Value.ValueTypeCase.INTEGER_VALUE; }
/** * Check if value is a double. * * @return {@code true} if value is a double. */ public boolean isDouble() { return value.getValueTypeCase() == com.google.datastore.v1.Value.ValueTypeCase.DOUBLE_VALUE; }
/** * @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 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 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(); }
/** * @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(); }
/** * @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(); }
/** * @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(); }
/** * @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 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 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 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(); }
/** * @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 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 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 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 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."); }