Java Code Examples for com.google.cloud.datastore.ListValue#newBuilder()
The following examples show how to use
com.google.cloud.datastore.ListValue#newBuilder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LowerCaseStringListIndexer.java From catatumbo with Apache License 2.0 | 6 votes |
@Override public Value<?> index(Value<?> input) { if (input.getType() == ValueType.NULL) { return NullValue.of(); } try { List<? extends Value<?>> list = ((ListValue) input).get(); ListValue.Builder builder = ListValue.newBuilder(); for (Value<?> item : list) { builder.addValue(ITEM_INDEXER.index(item)); } return builder.build(); } catch (Exception exp) { throw new IndexingException(exp); } }
Example 2
Source File: UpperCaseStringListIndexer.java From catatumbo with Apache License 2.0 | 6 votes |
@Override public Value<?> index(Value<?> input) { if (input.getType() == ValueType.NULL) { return NullValue.of(); } try { ListValue.Builder builder = ListValue.newBuilder(); List<? extends Value<?>> list = ((ListValue) input).get(); for (Value<?> item : list) { builder.addValue(ITEM_INDEXER.index(item)); } return builder.build(); } catch (Exception exp) { throw new IndexingException(exp); } }
Example 3
Source File: SetMapper.java From catatumbo with Apache License 2.0 | 5 votes |
@Override public ValueBuilder<?, ?, ?> toDatastore(Object input) { if (input == null) { return NullValue.newBuilder(); } Set<?> set = (Set<?>) input; ListValue.Builder listValueBuilder = ListValue.newBuilder(); for (Object item : set) { listValueBuilder .addValue(itemMapper.toDatastore(item).setExcludeFromIndexes(!indexed).build()); } return listValueBuilder; }
Example 4
Source File: ListMapper.java From catatumbo with Apache License 2.0 | 5 votes |
@Override public ValueBuilder<?, ?, ?> toDatastore(Object input) { if (input == null) { return NullValue.newBuilder(); } List<?> list = (List<?>) input; ListValue.Builder listValueBuilder = ListValue.newBuilder(); for (Object item : list) { listValueBuilder .addValue(itemMapper.toDatastore(item).setExcludeFromIndexes(!indexed).build()); } return listValueBuilder; }