本文整理汇总了Java中com.google.cloud.datastore.StringValue.of方法的典型用法代码示例。如果您正苦于以下问题:Java StringValue.of方法的具体用法?Java StringValue.of怎么用?Java StringValue.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.cloud.datastore.StringValue
的用法示例。
在下文中一共展示了StringValue.of方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: index
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Override
public Value<?> index(Value<?> input) {
if (input.getType() == ValueType.NULL) {
return NullValue.of();
}
try {
String str = ((StringValue) input).get();
return StringValue.of(str.toUpperCase(Locale.ENGLISH));
} catch (Exception exp) {
throw new IndexingException(exp);
}
}
示例2: index
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Override
public Value<?> index(Value<?> input) {
if (input.getType() == ValueType.NULL) {
return NullValue.of();
}
try {
String str = ((StringValue) input).get();
return StringValue.of(str.toLowerCase(Locale.ENGLISH));
} catch (Exception exp) {
throw new IndexingException(exp);
}
}
示例3: testIndex_2
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test
public void testIndex_2() {
StringValue input = StringValue.of("Hello World");
StringValue output = (StringValue) indexer.index(input);
assertEquals(input.get().toLowerCase(Locale.ENGLISH), output.get());
assertNotEquals(input.get(), output.get());
}
示例4: testIndex_2
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test
public void testIndex_2() {
StringValue input = StringValue.of("Hello World!");
StringValue output = (StringValue) indexer.index(input);
assertEquals(input.get().toUpperCase(Locale.ENGLISH), output.get());
assertNotEquals(input.get(), output.get());
}
示例5: testIndex_2
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test
public void testIndex_2() {
Value<?>[] inputArray = { StringValue.of("ONE"), StringValue.of("Two"),
StringValue.of("thRee") };
ListValue input = ListValue.of(Arrays.asList(inputArray));
ListValue output = (ListValue) indexer.index(input);
List<StringValue> inputList = (List<StringValue>) input.get();
List<StringValue> outputList = (List<StringValue>) output.get();
assertEquals(inputList.get(0).get().toUpperCase(Locale.ENGLISH), outputList.get(0).get());
assertEquals(inputList.get(1).get().toUpperCase(Locale.ENGLISH), outputList.get(1).get());
assertEquals(inputList.get(2).get().toUpperCase(Locale.ENGLISH), outputList.get(2).get());
}
示例6: testIndex_3
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test
public void testIndex_3() {
Value<?>[] inputArray = { StringValue.of("Hello"), NullValue.of() };
ListValue input = ListValue.of(Arrays.asList(inputArray));
ListValue output = (ListValue) indexer.index(input);
List<? extends Value> inputList = input.get();
List<? extends Value> outputList = output.get();
assertEquals(((StringValue) inputList.get(0)).get().toUpperCase(Locale.ENGLISH),
outputList.get(0).get());
assertEquals(inputList.get(1).get(), outputList.get(1).get());
}
示例7: testIndex_4
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test(expected = IndexingException.class)
public void testIndex_4() {
StringValue input = StringValue.of("Hello World");
try {
Value<?> output = indexer.index(input);
} catch (Exception exp) {
LOGGER.log(Level.INFO, exp.toString());
throw exp;
}
}
示例8: testIndex_5
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test(expected = IndexingException.class)
public void testIndex_5() {
Value<?>[] inputArray = { StringValue.of("Hello"), NullValue.of(), LongValue.of(5L) };
ListValue input = ListValue.of(Arrays.asList(inputArray));
try {
ListValue output = (ListValue) indexer.index(input);
} catch (Exception exp) {
LOGGER.log(Level.INFO, exp.toString());
throw exp;
}
}
示例9: testIndex_2
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test
public void testIndex_2() {
Value<?>[] inputArray = { StringValue.of("ONE"), StringValue.of("Two"),
StringValue.of("thRee") };
ListValue input = ListValue.of(Arrays.asList(inputArray));
ListValue output = (ListValue) indexer.index(input);
List<StringValue> inputList = (List<StringValue>) input.get();
List<StringValue> outputList = (List<StringValue>) output.get();
assertEquals(inputList.get(0).get().toLowerCase(Locale.ENGLISH), outputList.get(0).get());
assertEquals(inputList.get(1).get().toLowerCase(Locale.ENGLISH), outputList.get(1).get());
assertEquals(inputList.get(2).get().toLowerCase(Locale.ENGLISH), outputList.get(2).get());
}
示例10: testIndex_3
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test
public void testIndex_3() {
Value<?>[] inputArray = { StringValue.of("Hello"), NullValue.of() };
ListValue input = ListValue.of(Arrays.asList(inputArray));
ListValue output = (ListValue) indexer.index(input);
List<? extends Value> inputList = input.get();
List<? extends Value> outputList = output.get();
assertEquals(((StringValue) inputList.get(0)).get().toLowerCase(Locale.ENGLISH),
outputList.get(0).get());
assertEquals(inputList.get(1).get(), outputList.get(1).get());
}
示例11: testToModel2
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test(expected = MappingException.class)
public void testToModel2() {
StringValue v = StringValue.of("Hello");
ZonedDateTimeMapper mapper = new ZonedDateTimeMapper();
try {
mapper.toModel(v);
} catch (MappingException e) {
e.printStackTrace();
throw e;
}
}
示例12: testToModel2
import com.google.cloud.datastore.StringValue; //导入方法依赖的package包/类
@Test(expected = MappingException.class)
public void testToModel2() {
StringValue v = StringValue.of("Hello");
OffsetDateTimeMapper mapper = new OffsetDateTimeMapper();
try {
mapper.toModel(v);
} catch (MappingException e) {
e.printStackTrace();
throw e;
}
}