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


Java TypeUtils.isBoolean方法代码示例

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


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

示例1: render

import com.holonplatform.core.internal.utils.TypeUtils; //导入方法依赖的package包/类
@Override
public Field render(Property<T> property) {

	ObjectUtils.argumentNotNull(property, "Property must be not null");

	Class<?> propertyType = property.getType();

	// Try to render property according to a supported property type
	if (TypeUtils.isString(propertyType)) {
		// String
		return renderString(property);
	}
	if (TypeUtils.isBoolean(propertyType)) {
		// Boolean
		return renderBoolean(property);
	}
	if (TypeUtils.isEnum(propertyType)) {
		// Enum
		return renderEnum(property);
	}
	if (TypeUtils.isTemporal(propertyType)) {
		// Temporal
		return renderTemporal(property);
	}
	if (TypeUtils.isDate(propertyType)) {
		// Date
		return renderDate(property);
	}
	if (TypeUtils.isNumber(propertyType)) {
		// Number
		return renderNumber(property);
	}

	return null;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:36,代码来源:DefaultFieldPropertyRenderer.java

示例2: configure

import com.holonplatform.core.internal.utils.TypeUtils; //导入方法依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
	if (context.getConfiguration().getProperties()
			.containsKey(JacksonFeature.JAXRS_DISABLE_JACKSON_CONTEXT_RESOLVER)) {
		LOGGER.debug(() -> "Skip JacksonContextResolver registration, ["
				+ JacksonFeature.JAXRS_DISABLE_JACKSON_CONTEXT_RESOLVER + "] property detected");
		return false;
	}
	
	if (!context.getConfiguration().isRegistered(JacksonContextResolver.class)) {

		// check pretty print
		boolean prettyPrint = false;
		if (context.getConfiguration().getProperties().containsKey(JacksonFeature.JAXRS_JSON_PRETTY_PRINT)) {
			Object pp = context.getConfiguration().getProperties()
					.getOrDefault(JacksonFeature.JAXRS_JSON_PRETTY_PRINT, Boolean.FALSE);
			if (TypeUtils.isBoolean(pp.getClass()) && (boolean) pp) {
				prettyPrint = true;
			}
		}

		// register
		LOGGER.debug(() -> "<Runtime: " + context.getConfiguration().getRuntimeType()
				+ "> Registering ContextResolver [" + JacksonContextResolver.class.getName() + "]");
		context.register(new JacksonContextResolver(prettyPrint));
	}
	return true;
}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:29,代码来源:JacksonConfigurationFeature.java

示例3: configure

import com.holonplatform.core.internal.utils.TypeUtils; //导入方法依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
	// check disabled
	if (context.getConfiguration().getProperties().containsKey(GsonFeature.JAXRS_DISABLE_GSON_AUTO_CONFIG)) {
		LOGGER.debug(() -> "Skip GsonContextResolver registration, [" + GsonFeature.JAXRS_DISABLE_GSON_AUTO_CONFIG
				+ "] property detected");
		return false;
	}
	if (context.getConfiguration().getProperties().containsKey(GsonFeature.JAXRS_DISABLE_GSON_CONTEXT_RESOLVER)) {
		LOGGER.debug(() -> "Skip GsonContextResolver registration, ["
				+ GsonFeature.JAXRS_DISABLE_GSON_CONTEXT_RESOLVER + "] property detected");
		return false;
	}
	if (!context.getConfiguration().isRegistered(GsonContextResolver.class)) {

		// check pretty print
		boolean prettyPrint = false;
		if (context.getConfiguration().getProperties().containsKey(GsonFeature.JAXRS_JSON_PRETTY_PRINT)) {
			Object pp = context.getConfiguration().getProperties().getOrDefault(GsonFeature.JAXRS_JSON_PRETTY_PRINT,
					Boolean.FALSE);
			if (TypeUtils.isBoolean(pp.getClass()) && (boolean) pp) {
				prettyPrint = true;
			}
		}

		// register
		LOGGER.debug(() -> "<Runtime: " + context.getConfiguration().getRuntimeType()
				+ "> Registering ContextResolver [" + GsonContextResolver.class.getName() + "]");
		context.register(new GsonContextResolver(prettyPrint));
	}
	return true;
}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:33,代码来源:GsonContextResolverFeature.java

示例4: serializeParameterValue

import com.holonplatform.core.internal.utils.TypeUtils; //导入方法依赖的package包/类
/**
 * Serialize given parameter value as String
 * @param value Value to serialize
 * @param dateFormat Date format to use with {@link Date} value types
 * @return Serialized value
 */
private static String serializeParameterValue(Object value, DateFormat dateFormat) {
	if (!isNullOrEmpty(value)) {
		if (TypeUtils.isString(value.getClass())) {
			return (String) value;
		}
		if (TypeUtils.isBoolean(value.getClass())) {
			return ((Boolean) value) ? "true" : "false";
		}
		if (TypeUtils.isEnum(value.getClass())) {
			int ordinal = ((Enum<?>) value).ordinal();
			return String.valueOf(ordinal);
		}
		if (TypeUtils.isNumber(value.getClass())) {
			if (TypeUtils.isDecimalNumber(value.getClass())) {
				return PARAMETER_VALUE_DECIMAL_FORMAT.format(value);
			} else {
				return PARAMETER_VALUE_INTEGER_FORMAT.format(value);
			}
		}
		if (TypeUtils.isDate(value.getClass())) {
			return dateFormat.format((Date) value);
		}
		if (TypeUtils.isTemporal(value.getClass())) {
			TemporalType type = TemporalType.getTemporalType((Temporal) value);
			if (type == null) {
				type = TemporalType.DATE;
			}
			switch (type) {
			case DATE_TIME:
				return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format((Temporal) value);
			case TIME:
				return DateTimeFormatter.ISO_LOCAL_TIME.format((Temporal) value);
			case DATE:
			default:
				return DateTimeFormatter.ISO_LOCAL_DATE.format((Temporal) value);
			}
		}
		throw new UnsupportedOperationException(
				"Parameter value serialization " + "not supported for type: " + value.getClass().getName());
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:49,代码来源:ViewNavigationUtils.java

示例5: isIntrospectable

import com.holonplatform.core.internal.utils.TypeUtils; //导入方法依赖的package包/类
private static boolean isIntrospectable(Class<?> propertyClass) {
	return propertyClass != Object.class && !propertyClass.isArray() && !propertyClass.isPrimitive()
			&& !propertyClass.isEnum() && !TypeUtils.isString(propertyClass) && !TypeUtils.isNumber(propertyClass)
			&& !TypeUtils.isTemporalOrCalendar(propertyClass) && !TypeUtils.isBoolean(propertyClass)
			&& !Collection.class.isAssignableFrom(propertyClass);
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:7,代码来源:DefaultBeanIntrospector.java

示例6: classToJdbcType

import com.holonplatform.core.internal.utils.TypeUtils; //导入方法依赖的package包/类
/**
 * Get the SQL type which corresponds to given Java type.
 * @param type Java type
 * @return SQL type
 */
public static int classToJdbcType(Class<?> type) {
	if (type == null) {
		return Types.NULL;
	}

	if (String.class.isAssignableFrom(type)) {
		return Types.VARCHAR;
	}

	if (TypeUtils.isBoolean(type)) {
		return Types.BOOLEAN;
	}

	if (TypeUtils.isInteger(type)) {
		return Types.INTEGER;
	}
	if (TypeUtils.isLong(type)) {
		return Types.BIGINT;
	}
	if (TypeUtils.isDouble(type) || TypeUtils.isFloat(type) || TypeUtils.isBigDecimal(type)) {
		return Types.DECIMAL;
	}
	if (TypeUtils.isShort(type)) {
		return Types.SMALLINT;
	}
	if (TypeUtils.isByte(type)) {
		return Types.TINYINT;
	}
	if (TypeUtils.isNumber(type)) {
		return Types.NUMERIC;
	}

	if (type == byte[].class) {
		return Types.BINARY;
	}

	if (TypeUtils.isDate(type) || TypeUtils.isCalendar(type) || java.sql.Date.class.isAssignableFrom(type)
			|| LocalDate.class.isAssignableFrom(type)) {
		return Types.DATE;
	}
	if (LocalTime.class.isAssignableFrom(type) || java.sql.Time.class.isAssignableFrom(type)) {
		return Types.TIME;
	}
	if (LocalDateTime.class.isAssignableFrom(type) || java.sql.Timestamp.class.isAssignableFrom(type)) {
		return Types.TIMESTAMP;
	}
	if (ZonedDateTime.class.isAssignableFrom(type)) {
		return Types.TIMESTAMP_WITH_TIMEZONE;
	}

	return Types.OTHER;
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jdbc,代码行数:58,代码来源:JdbcDatastoreUtils.java

示例7: isAdmittedParameterFieldType

import com.holonplatform.core.internal.utils.TypeUtils; //导入方法依赖的package包/类
/**
 * Check parameter field type
 * @param type Field type
 * @return <code>true</code> if type is admitted as view parameter value
 */
private static boolean isAdmittedParameterFieldType(Class<?> type) {
	return TypeUtils.isString(type) || TypeUtils.isNumber(type) || TypeUtils.isBoolean(type)
			|| TypeUtils.isDate(type) || TypeUtils.isLocalTemporal(type) || TypeUtils.isEnum(type);
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:10,代码来源:ViewNavigationUtils.java


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