当前位置: 首页>>代码示例>>Java>>正文


Java StringValue.of方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:13,代码来源:UpperCaseStringIndexer.java

示例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);
  }
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:13,代码来源:LowerCaseStringIndexer.java

示例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());
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:8,代码来源:LowerCaseStringIndexerTest.java

示例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());
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:8,代码来源:UpperCaseStringIndexerTest.java

示例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());
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:13,代码来源:UpperCaseStringListIndexerTest.java

示例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());
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:12,代码来源:UpperCaseStringListIndexerTest.java

示例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;
  }
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:11,代码来源:UpperCaseStringListIndexerTest.java

示例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;
  }
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:12,代码来源:UpperCaseStringListIndexerTest.java

示例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());
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:13,代码来源:LowerCaseStringListIndexerTest.java

示例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());
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:12,代码来源:LowerCaseStringListIndexerTest.java

示例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;
  }
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:12,代码来源:ZonedDateTimeMapperTest.java

示例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;
  }
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:12,代码来源:OffsetDateTimeMapperTest.java


注:本文中的com.google.cloud.datastore.StringValue.of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。