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


Java IndexType类代码示例

本文整理汇总了Java中com.threewks.gaetools.search.gae.meta.IndexType的典型用法代码示例。如果您正苦于以下问题:Java IndexType类的具体用法?Java IndexType怎么用?Java IndexType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IndexType类属于com.threewks.gaetools.search.gae.meta包,在下文中一共展示了IndexType类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildSortOptions

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
protected SortOptions.Builder buildSortOptions(List<OrderComponent> order) {
    SortOptions.Builder sortOptions = SortOptions.newBuilder();
    for (OrderComponent sort : order) {
        String fieldName = getEncodedFieldName(sort.getField());
        SortExpression.Builder expression = SortExpression.newBuilder().setExpression(fieldName);
        expression = expression.setDirection(sort.isAscending() ? SortExpression.SortDirection.ASCENDING : SortExpression.SortDirection.DESCENDING);
        IndexType indexType = metadata.getIndexType(sort.getField());
        if (IndexType.SmallDecimal == indexType || IndexType.BigDecimal == indexType) {
            expression = expression.setDefaultValueNumeric(sort.isDescending() ? IntLow : IntHigh);
        } else if (IndexType.Date == indexType) {
            expression = expression.setDefaultValueDate(sort.isDescending() ? DateLow : DateHigh);
        } else {
            expression = expression.setDefaultValue(sort.isDescending() ? StringLow : StringHigh);
        }
        sortOptions = sortOptions.addSortExpression(expression);
    }
    return sortOptions;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:19,代码来源:BaseGaeSearchService.java

示例2: shouldConvertObjectToEnum

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@Test
public void shouldConvertObjectToEnum() {
    ObjectToEnum<Object, IndexType> transformer = new ObjectToEnum<>(IndexType.class);

    assertThat(transformer.from(null), is(nullValue()));
    assertThat(transformer.from(""), is(nullValue()));
    assertThat(transformer.from("junk"), is(nullValue()));
    assertThat(transformer.from(1), is(nullValue()));

    assertThat(transformer.from("Automatic"), is(IndexType.Automatic));
    assertThat(transformer.from("automatic"), is(IndexType.Automatic));
    assertThat(transformer.from("AUTOMATIC"), is(IndexType.Automatic));
    assertThat(transformer.from("  AutoMATIC  "), is(IndexType.Automatic));

    assertThat(transformer.from("BigDecimal"), is(IndexType.BigDecimal));
    assertThat(transformer.from("bigdecimal"), is(IndexType.BigDecimal));
    assertThat(transformer.from("BIGDECIMAL"), is(IndexType.BigDecimal));
    assertThat(transformer.from("  BigdeCImal  "), is(IndexType.BigDecimal));

    assertThat(transformer.from(IndexType.BigDecimal), is(IndexType.BigDecimal));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:22,代码来源:ObjectToEnumTest.java

示例3: buildField

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
<F> Field buildField(SearchMetadata<T, K> metadata, String field, Object value) {
    com.google.appengine.api.search.Field.Builder fieldBuilder = Field.newBuilder().setName(metadata.getEncodedFieldName(field));
    IndexType indexType = metadata.getIndexType(field);
    FieldMediator<F> fieldMediator = fieldMediators.get(indexType);
    F normalised = fieldMediator.normalise(transformerManager, value);
    fieldMediator.setValue(fieldBuilder, normalised);
    return fieldBuilder.build();
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:9,代码来源:BaseGaeSearchService.java

示例4: convertValuesToString

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
protected List<String> convertValuesToString(String field, Collection<Object> values) {
    IndexType indexType = metadata.getIndexType(field);
    FieldMediator<?> indexTypeFieldBuilder = fieldMediators.get(indexType);
    List<String> stringValues = new ArrayList<>();
    for (Object value : values) {
        stringValues.add(convertSingleValueToString(field, value, metadata, indexTypeFieldBuilder));
    }
    return stringValues;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:BaseGaeSearchService.java

示例5: get

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T> FieldMediator<T> get(IndexType indexType) {
    FieldMediator<T> result = (FieldMediator<T>) fieldMediators.get(indexType);
    if (result == null) {
        throw new SearchException("No %s present for %s '%s'", FieldMediator.class.getSimpleName(), IndexType.class.getSimpleName(), indexType);
    }
    return result;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:9,代码来源:FieldMediatorSet.java

示例6: initIndexFieldBuilders

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
protected static Map<IndexType, FieldMediator<?>> initIndexFieldBuilders() {
    Map<IndexType, FieldMediator<?>> map = new HashMap<>();
    map.put(IndexType.Automatic, new TextFieldMediator());
    map.put(IndexType.BigDecimal, new BigDecimalFieldMediator());
    map.put(IndexType.Date, new DateFieldMediator());
    map.put(IndexType.GeoPoint, new GeoPointFieldMediator());
    map.put(IndexType.Html, new HtmlFieldMediator());
    map.put(IndexType.Identifier, new AtomFieldMediator());
    map.put(IndexType.SmallDecimal, new SmallDecimalFieldMediator());
    map.put(IndexType.Text, new TextFieldMediator());
    return map;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:13,代码来源:FieldMediatorSet.java

示例7: defaultIndexTypeLookup

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
public static IndexTypeLookup defaultIndexTypeLookup() {
    IndexTypeLookup indexTypeLookup = new IndexTypeLookup();
    indexTypeLookup.addMapping(Key.class, IndexType.Identifier);
    indexTypeLookup.addMapping(com.google.appengine.api.datastore.Key.class, IndexType.Identifier);
    indexTypeLookup.addMapping(GeoPt.class, IndexType.GeoPoint);
    return indexTypeLookup;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:SearchModule.java

示例8: shouldNormaliseDifferentTypes

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@Test
public void shouldNormaliseDifferentTypes() {
    assertThat(atomFieldMediator.normalise(TransformerManager.createWithDefaults(), "value"), is("value"));
    assertThat(atomFieldMediator.normalise(TransformerManager.createWithDefaults(), 1), is("1"));
    assertThat(atomFieldMediator.normalise(TransformerManager.createWithDefaults(), IndexType.Automatic), is("Automatic"));
    assertThat(atomFieldMediator.normalise(TransformerManager.createWithDefaults(), true), is("true"));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:AtomFieldMediatorTest.java

示例9: shouldNormaliseDifferentTypes

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@Test
public void shouldNormaliseDifferentTypes() {
    assertThat(mediator.normalise(TransformerManager.createWithDefaults(), "value"), is("value"));
    assertThat(mediator.normalise(TransformerManager.createWithDefaults(), 1), is("1"));
    assertThat(mediator.normalise(TransformerManager.createWithDefaults(), IndexType.Automatic), is("Automatic"));
    assertThat(mediator.normalise(TransformerManager.createWithDefaults(), true), is("true"));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:HtmlFieldMediatorTest.java

示例10: shouldHaveAMediatorForEachIndexTypeByDefault

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@Test
public void shouldHaveAMediatorForEachIndexTypeByDefault() {
    FieldMediatorSet fieldMediatorSet = new FieldMediatorSet();
    for (IndexType indexType : IndexType.values()) {
        assertThat(fieldMediatorSet.get(indexType), is(notNullValue()));
    }
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:FieldMediatorSetTest.java

示例11: shouldFailIfAFieldMediatorIsMissing

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@Test
public void shouldFailIfAFieldMediatorIsMissing() {
    thrown.expect(SearchException.class);
    thrown.expectMessage("No FieldMediator present for IndexType 'Automatic'");

    FieldMediatorSet fieldMediatorSet = new FieldMediatorSet();
    FieldMediator<?> fieldMediator = fieldMediatorSet.get(IndexType.Automatic);
    assertThat(fieldMediator, is(notNullValue()));

    fieldMediatorSet.put(IndexType.Automatic, null);

    fieldMediator = fieldMediatorSet.get(IndexType.Automatic);
    assertThat(fieldMediator, is(nullValue()));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:15,代码来源:FieldMediatorSetTest.java

示例12: shouldAllowReplacementOfFieldMediator

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void shouldAllowReplacementOfFieldMediator() {
    FieldMediatorSet fieldMediatorSet = new FieldMediatorSet();
    FieldMediator<Object> mediator = mock(FieldMediator.class);
    fieldMediatorSet.put(IndexType.BigDecimal, mediator);

    assertThat(fieldMediatorSet.get(IndexType.BigDecimal), is(mediator));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:FieldMediatorSetTest.java

示例13: shouldTransformEnumFromStringUsingBestTransformer

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@Test
public void shouldTransformEnumFromStringUsingBestTransformer() {
    ETransformer<? super String, ? extends IndexType> transformer = transformerManager.getBestTransformer(String.class, IndexType.class);
    assertThat(transformer, is(notNullValue()));

    assertThat(transformer.from("Automatic"), is(IndexType.Automatic));
    assertThat(transformer.from("automatic"), is(IndexType.Automatic));
    assertThat(transformer.from("AUTOMATIC"), is(IndexType.Automatic));

}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:11,代码来源:TransformerManagerTest.java

示例14: shouldTransformObjectToEnum

import com.threewks.gaetools.search.gae.meta.IndexType; //导入依赖的package包/类
@Test
public void shouldTransformObjectToEnum() {
    ETransformer<? super Object, ? extends IndexType> transformer = transformerManager.getTransformer(Object.class, IndexType.class);
    assertThat(transformer, is(notNullValue()));

    assertThat(transformer.from("Automatic"), is(IndexType.Automatic));
    assertThat(transformer.from("automatic"), is(IndexType.Automatic));
    assertThat(transformer.from("AUTOMATIC"), is(IndexType.Automatic));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:TransformerManagerTest.java


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