本文整理汇总了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;
}
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);