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


Java Field.Builder方法代码示例

本文整理汇总了Java中com.google.appengine.api.search.Field.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java Field.Builder方法的具体用法?Java Field.Builder怎么用?Java Field.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.appengine.api.search.Field的用法示例。


在下文中一共展示了Field.Builder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMutator

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
private BiConsumer<Field.Builder, Object> getMutator(IndexType indexType) {
    switch (indexType) {
        case IDENTIFIER:
            return this::setAtom;
        case NUMBER:
            return this::setNumber;
        case HTML:
            return this::setHtml;
        case DATE:
            return this::setDate;
        case GEOPOINT:
            return this::setGeopoint;
        default:
            return this::setText;
    }
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:17,代码来源:FieldBuilder.java

示例2: apply

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
@Override
public List<Field> apply(SearchFieldMetadata searchFieldMetadata, @Nullable Object fieldValue) {
    assertSupportedMultiplicity(searchFieldMetadata, fieldValue);

    Collection<?> values = toValueList(fieldValue);
    BiConsumer<Field.Builder, Object> mutator = getMutator(searchFieldMetadata.getIndexType());

    return values.stream()
            .map(value -> {
                Field.Builder field = Field.newBuilder();
                field.setName(searchFieldMetadata.getEncodedName());
                mutator.accept(field, value);
                return field.build();
            }).collect(Collectors.toList());
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:16,代码来源:FieldBuilder.java

示例3: addDocument

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
public void addDocument(Index index, String docid) {
  Document.Builder builder = Document.newBuilder();
  builder.setId(docid);
  builder.setRank(docid.hashCode());

  Field.Builder field = Field.newBuilder();
  field.setName("title");
  field.setText(String.format("Title: title%%<%s>", docid));
  builder.addField(field);

  field = Field.newBuilder();
  field.setName("body");
  field.setHTML(String.format("<h3>body of %s, some string</h3>", docid));
  builder.addField(field);

  field = Field.newBuilder();
  field.setName("atom");
  field.setAtom(String.format("atom%% <%s>", docid));
  builder.addField(field);

  field = Field.newBuilder();
  field.setName("number");
  field.setNumber(docid.hashCode() % 4096);
  builder.addField(field);

  field = Field.newBuilder();
  field.setName("date");
  field.setDate(new Date(2011 - 1900, 11 - 1, (docid.hashCode() % 30) + 1));
  builder.addField(field);

  index.put(builder.build());
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:33,代码来源:SearchServlet.java

示例4: setAtom

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
private void setAtom(Field.Builder field, Object value) {
    String normalized = conversionService.convert(value, String.class);
    field.setAtom(normalized);
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:5,代码来源:FieldBuilder.java

示例5: setText

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
private void setText(Field.Builder field, Object value) {
    String normalized = conversionService.convert(value, String.class);
    field.setText(normalized);
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:5,代码来源:FieldBuilder.java

示例6: setHtml

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
private void setHtml(Field.Builder field, Object value) {
    String normalized = conversionService.convert(value, String.class);
    field.setHTML(normalized);
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:5,代码来源:FieldBuilder.java

示例7: setNumber

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
private void setNumber(Field.Builder field, Object value) {
    Double normalized = conversionService.convert(value, Double.class);
    field.setNumber(normalized);
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:5,代码来源:FieldBuilder.java

示例8: setDate

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
private void setDate(Field.Builder field, Object value) {
    Date normalized = conversionService.convert(value, Date.class);
    field.setDate(normalized);
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:5,代码来源:FieldBuilder.java

示例9: setGeopoint

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
private void setGeopoint(Field.Builder field, Object value) {
    GeoPoint normalized = conversionService.convert(value, GeoPoint.class);
    field.setGeoPoint(normalized);
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:5,代码来源:FieldBuilder.java

示例10: setValue

import com.google.appengine.api.search.Field; //导入方法依赖的package包/类
/**
 * Set the normalised value into the given field
 *
 * @param builder
 * @param value
 */
void setValue(Field.Builder builder, T value);
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:FieldMediator.java


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