本文整理了Java中com.google.cloud.datastore.KeyValue.of()
方法的一些代码示例,展示了KeyValue.of()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyValue.of()
方法的具体详情如下:
包路径:com.google.cloud.datastore.KeyValue
类名称:KeyValue
方法名:of
暂无
代码示例来源:origin: googleapis/google-cloud-java
/** Adds the provided {@code Key} values to the {@code ListValue} builder. */
public Builder addValue(Key first, Key... other) {
listBuilder.add(KeyValue.of(first));
for (Key value : other) {
listBuilder.add(KeyValue.of(value));
}
return this;
}
代码示例来源:origin: googleapis/google-cloud-java
/**
* Sets a property of type {@link KeyValue}.
*
* @param name name of the property
* @param value value associated with the property
*/
public B set(String name, Key value) {
properties.put(name, of(value));
return self();
}
代码示例来源:origin: googleapis/google-cloud-java
public static PropertyFilter ge(String property, Key value) {
return new PropertyFilter(property, Operator.GREATER_THAN_OR_EQUAL, of(value));
}
代码示例来源:origin: googleapis/google-cloud-java
/**
* Sets a list property containing elements of type {@link KeyValue}.
*
* @param name name of the property
* @param first the first {@link Key} in the list
* @param second the second {@link Key} in the list
* @param others other {@link Key}s in the list
*/
public B set(String name, Key first, Key second, Key... others) {
List<KeyValue> values = new LinkedList<>();
values.add(of(first));
values.add(of(second));
for (Key other : others) {
values.add(of(other));
}
properties.put(name, of(values));
return self();
}
代码示例来源:origin: googleapis/google-cloud-java
public static PropertyFilter lt(String property, Key value) {
return new PropertyFilter(property, Operator.LESS_THAN, of(value));
}
代码示例来源:origin: googleapis/google-cloud-java
public static PropertyFilter hasAncestor(Key key) {
return new PropertyFilter(KEY_PROPERTY_NAME, Operator.HAS_ANCESTOR, of(key));
}
代码示例来源:origin: googleapis/google-cloud-java
public static PropertyFilter le(String property, Key value) {
return new PropertyFilter(property, Operator.LESS_THAN_OR_EQUAL, of(value));
}
代码示例来源:origin: googleapis/google-cloud-java
public static PropertyFilter gt(String property, Key value) {
return new PropertyFilter(property, Operator.GREATER_THAN, of(value));
}
代码示例来源:origin: googleapis/google-cloud-java
public static PropertyFilter eq(String property, Key value) {
return new PropertyFilter(property, Operator.EQUAL, of(value));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testToBuilder() throws Exception {
KeyValue value = KeyValue.of(CONTENT);
assertEquals(value, value.toBuilder().build());
}
代码示例来源:origin: objectify/objectify
@Override
protected Value<Key> toDatastore(final Key value) {
return KeyValue.of(value);
}
}
代码示例来源:origin: googleapis/google-cloud-java
@SuppressWarnings("deprecation")
@Test
public void testOf() throws Exception {
KeyValue value = KeyValue.of(CONTENT);
assertEquals(CONTENT, value.get());
assertFalse(value.excludeFromIndexes());
}
代码示例来源:origin: objectify/objectify
@Override
protected Value<com.google.cloud.datastore.Key> toDatastore(final Key<?> value) {
return KeyValue.of(value.getRaw());
}
}
代码示例来源:origin: objectify/objectify
@Override
protected Value<com.google.cloud.datastore.Key> saveValue(final Ref<?> value, final SaveContext ctx, final Path path) throws SkipException {
return KeyValue.of(ctx.saveRef(value, loadConditions));
}
};
代码示例来源:origin: googleapis/google-cloud-java
assertEquals(ImmutableList.of(LatLngValue.of(LATLNG1), LatLngValue.of(LATLNG2)), value.get());
value = ListValue.of(KEY1);
assertEquals(ImmutableList.of(KeyValue.of(KEY1)), value.get());
value = ListValue.of(KEY1, KEY2);
assertEquals(ImmutableList.of(KeyValue.of(KEY1), KeyValue.of(KEY2)), value.get());
value = ListValue.of(ENTITY1);
assertEquals(ImmutableList.of(EntityValue.of(ENTITY1)), value.get());
代码示例来源:origin: googleapis/google-cloud-java
assertEquals(ImmutableList.of(KeyValue.of(KEY1)), builder.build().get());
builder = builder.set(Collections.<Value<?>>emptyList());
assertEquals(ImmutableList.of(KeyValue.of(KEY1), KeyValue.of(KEY2)), builder.build().get());
builder = builder.set(Collections.<Value<?>>emptyList());
代码示例来源:origin: objectify/objectify
/**
* Sets the key onto the POJO id/parent fields
*/
@SuppressWarnings("unchecked")
private void setKey(final P pojo, final IncompleteKey key, final LoadContext ctx, final Path containerPath) {
if (!clazz.isAssignableFrom(pojo.getClass()))
throw new IllegalArgumentException("Trying to use metadata for " + clazz.getName() + " to set key of " + pojo.getClass().getName());
// If no key, don't need to do anything
if (key == null)
return;
idMeta.setValue(pojo, Keys.getIdValue(key), ctx, containerPath);
final com.google.cloud.datastore.Key parentKey = key.getParent();
if (parentKey != null) {
if (this.parentMeta == null)
throw new IllegalStateException("Loaded Entity has parent but " + clazz.getName() + " has no @Parent");
parentMeta.setValue(pojo, (Value)KeyValue.of(parentKey), ctx, containerPath);
}
}
代码示例来源:origin: objectify/objectify
return KeyValue.of(factory().keys().rawKeyOf(value));
} else {
代码示例来源:origin: com.google.cloud/google-cloud-datastore
/** Adds the provided {@code Key} values to the {@code ListValue} builder. */
public Builder addValue(Key first, Key... other) {
listBuilder.add(KeyValue.of(first));
for (Key value : other) {
listBuilder.add(KeyValue.of(value));
}
return this;
}
代码示例来源:origin: com.google.cloud/google-cloud-datastore
/**
* Sets a property of type {@link KeyValue}.
*
* @param name name of the property
* @param value value associated with the property
*/
public B set(String name, Key value) {
properties.put(name, of(value));
return self();
}
内容来源于网络,如有侵权,请联系作者删除!