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


Java ColumnType.isBoolean方法代码示例

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


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

示例1: getSize

import org.apache.metamodel.schema.ColumnType; //导入方法依赖的package包/类
/**
 * Gets the size (in bytes) of a column with a specific {@link ColumnType}
 * and size
 */
private int getSize(ColumnType type, int columnSize) {
	final int baseSize;
	if (type.isBinary()) {
		baseSize = 1;
	} else if (type.isBoolean()) {
		baseSize = 1;
	} else if (type.isLiteral()) {
		baseSize = 2;
	} else if (type.isNumber()) {
		baseSize = 16;
	} else {
		baseSize = DEFAULT_COLUMN_SIZE;
	}

	int result = baseSize * columnSize;

	if (type.isLargeObject()) {
		// assign at least 4KB for LOBs.
		result = Math.max(result, 4 * KB);
	}

	return result;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:28,代码来源:FetchSizeCalculator.java

示例2: convert

import org.apache.metamodel.schema.ColumnType; //导入方法依赖的package包/类
private Object convert(final String value, final ColumnType type) {
    if (value == null) {
        return null;
    }
    if (type == null) {
        return value;
    }

    final Object result;
    if (type.isNumber()) {
        result = NumberComparator.toNumber(value);
    } else if (type.isBoolean()) {
        result = BooleanComparator.toBoolean(value);
    } else if (type.isTimeBased()) {
        result = TimeComparator.toDate(value);
    } else {
        result = value;
    }

    if (result == null) {
        throw new IllegalStateException("Failed to convert value '" + value + "' to type: " + type);
    }

    return result;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:26,代码来源:SugarCrmDataSet.java

示例3: convert

import org.apache.metamodel.schema.ColumnType; //导入方法依赖的package包/类
private Object convert(Object value, ColumnType columnType) {
    if (value instanceof String && !columnType.isLiteral()) {
        if (columnType.isBoolean()) {
            return BooleanComparator.toBoolean(value);
        }
        if (columnType.isNumber()) {
            return NumberComparator.toNumber(value);
        }
        if (columnType.isTimeBased()) {
            final SimpleDateFormat dateFormat;
            if (columnType == ColumnType.DATE) {
                // note: we don't apply the timezone for DATE fields, since
                // they don't contain time-of-day information.
                dateFormat = new SimpleDateFormat(SalesforceDataContext.SOQL_DATE_FORMAT_IN, Locale.ENGLISH);
            } else if (columnType == ColumnType.TIME) {
                dateFormat = new SimpleDateFormat(SalesforceDataContext.SOQL_TIME_FORMAT_IN, Locale.ENGLISH);
                dateFormat.setTimeZone(SalesforceDataContext.SOQL_TIMEZONE);
            } else {
                dateFormat = new SimpleDateFormat(SalesforceDataContext.SOQL_DATE_TIME_FORMAT_IN, Locale.ENGLISH);
                dateFormat.setTimeZone(SalesforceDataContext.SOQL_TIMEZONE);
            }

            try {
                return dateFormat.parse(value.toString());
            } catch (ParseException e) {
                throw new IllegalStateException("Unable to parse date/time value: " + value);
            }
        }
    }
    return value;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:32,代码来源:SalesforceDataSet.java

示例4: getExpectedColumnType

import org.apache.metamodel.schema.ColumnType; //导入方法依赖的package包/类
@Override
public ColumnType getExpectedColumnType(ColumnType type) {
    if (type.isBoolean()) {
        return type;
    }
    return ColumnType.BOOLEAN;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:8,代码来源:ToBooleanFunction.java

示例5: createOperand

import org.apache.metamodel.schema.ColumnType; //导入方法依赖的package包/类
private Object createOperand(final String token, final SelectItem leftSelectItem, final boolean searchSelectItems) {
    if (token.equalsIgnoreCase("NULL")) {
        return null;
    }

    if (token.startsWith("'") && token.endsWith("'") && token.length() > 2) {
        String stringOperand = token.substring(1, token.length() - 1);
        stringOperand = stringOperand.replaceAll("\\\\'", "'");
        return stringOperand;
    }

    if (searchSelectItems) {
        final SelectItem selectItem = findSelectItem(token, false);
        if (selectItem != null) {
            return selectItem;
        }
    }

    final ColumnType expectedColumnType = leftSelectItem.getExpectedColumnType();
    final Object result;
    if (expectedColumnType == null) {
        // We're assuming number here, but it could also be boolean or a
        // time based type. But anyways, this should not happen since
        // expected column type should be available.
        result = NumberComparator.toNumber(token);
    } else if (expectedColumnType.isBoolean()) {
        result = BooleanComparator.toBoolean(token);
    } else if (expectedColumnType.isTimeBased()) {
        result = FormatHelper.parseSqlTime(expectedColumnType, token);
    } else {
        result = NumberComparator.toNumber(token);
    }

    if (result == null) {
        // shouldn't happen since only "NULL" is parsed as null.
        throw new QueryParserException("Could not parse operand: " + token);
    }

    return result;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:41,代码来源:Query.java

示例6: isBoolean

import org.apache.metamodel.schema.ColumnType; //导入方法依赖的package包/类
private static boolean isBoolean(ColumnType columnType, Object operand) {
    if (columnType == null) {
        return operand instanceof Boolean;
    }
    return columnType.isBoolean();
}
 
开发者ID:apache,项目名称:metamodel,代码行数:7,代码来源:FormatHelper.java


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