本文整理汇总了Java中io.crate.types.BooleanType类的典型用法代码示例。如果您正苦于以下问题:Java BooleanType类的具体用法?Java BooleanType怎么用?Java BooleanType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BooleanType类属于io.crate.types包,在下文中一共展示了BooleanType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrimitiveTypeFromESType
import io.crate.types.BooleanType; //导入依赖的package包/类
public static PrimitiveType getPrimitiveTypeFromESType(DataType t) {
if (t.getName().equals(StringType.INSTANCE.getName())) {
return PrimitiveType.STRING;
} else if (t.getName().equals(BooleanType.INSTANCE.getName())) {
return PrimitiveType.BOOL;
} else if (t.getName().equals(ByteType.INSTANCE.getName())) {
return PrimitiveType.BYTE;
} else if (t.getName().equals(DoubleType.INSTANCE.getName())) {
return PrimitiveType.DOUBLE;
} else if (t.getName().equals(FloatType.INSTANCE.getName())) {
return PrimitiveType.FLOAT;
} else if (t.getName().equals(IntegerType.INSTANCE.getName())) {
return PrimitiveType.INT;
} else if (t.getName().equals(LongType.INSTANCE.getName())) {
return PrimitiveType.LONG;
} else if (t.getName().equals(ShortType.INSTANCE.getName())) {
return PrimitiveType.SHORT;
} else if (t.getName().equals(TimestampType.INSTANCE.getName())) {
return PrimitiveType.TIMESTAMP;
}
return PrimitiveType.STRING;
}
示例2: shouldMapSimpleTypes
import io.crate.types.BooleanType; //导入依赖的package包/类
@Test
public void shouldMapSimpleTypes() {
String[] columns = {"string", "integer", "bool", "locale"};
DataType<?>[] types = { StringType.INSTANCE, IntegerType.INSTANCE,
BooleanType.INSTANCE, StringType.INSTANCE };
Object[] row = new Object[]{"DOCUMENT", 1, true, CANADA};
Map<String, Object> expected = new HashMap<String, Object>();
expected.put("string", "DOCUMENT");
expected.put("integer", 1);
expected.put("bool", true);
expected.put("locale", CANADA);
converter = new CrateDocumentConverter(columns, types, row);
CrateDocument document = converter.toDocument();
assertThat(document, is(notNullValue()));
assertThat(document.equals(expected), is(true));
}
示例3: getForTypes
import io.crate.types.BooleanType; //导入依赖的package包/类
@Override
public FunctionImplementation<Function> getForTypes(List<DataType> dataTypes) throws IllegalArgumentException {
checkArgument(dataTypes.size() == 2, "ANY operator requires exactly 2 arguments");
checkArgument(DataTypes.isCollectionType(dataTypes.get(1)), "The second argument to ANY must be an array or set");
checkArgument(((CollectionType) dataTypes.get(1)).innerType().equals(dataTypes.get(0)),
"The inner type of the array/set passed to ANY must match its left expression");
return newInstance(new FunctionInfo(new FunctionIdent(name(), dataTypes), BooleanType.INSTANCE));
}
示例4: validate
import io.crate.types.BooleanType; //导入依赖的package包/类
@Override
protected Object validate(Object value) {
return BooleanType.INSTANCE.value(value);
}