本文整理汇总了Java中org.apache.commons.beanutils.BeanUtilsBean.setInstance方法的典型用法代码示例。如果您正苦于以下问题:Java BeanUtilsBean.setInstance方法的具体用法?Java BeanUtilsBean.setInstance怎么用?Java BeanUtilsBean.setInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.beanutils.BeanUtilsBean
的用法示例。
在下文中一共展示了BeanUtilsBean.setInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerDateConverter
import org.apache.commons.beanutils.BeanUtilsBean; //导入方法依赖的package包/类
/**
* 重新注册日期转换器
* @param patterns
*/
private static void registerDateConverter(String ... patterns) {
setPatterns(patterns);
BeanUtilsBean.setInstance(new BeanUtilsBean(extConvertUtilsBean));
ConvertUtils.register(calendarConverter, Calendar.class);
ConvertUtils.register(dateConverter, java.util.Date.class);
ConvertUtils.register(sqlDateConverter, java.sql.Date.class);
ConvertUtils.register(sqlTimeConverter, java.sql.Time.class);
}
示例2: prepare
import org.apache.commons.beanutils.BeanUtilsBean; //导入方法依赖的package包/类
private static void prepare(){
//使用自定义的替换
BeanUtilsBean beanUtilsBean = new BeanUtilsBean(new CustConvertUtilsBean(),new PropertyUtilsBean());
BeanUtilsBean.setInstance(beanUtilsBean);
//注册转换器,处理日期
registDateConvert();
//注册转换器,处理枚举
registEnumConvert();
}
示例3: prepare
import org.apache.commons.beanutils.BeanUtilsBean; //导入方法依赖的package包/类
private static void prepare(){
//使用自定义的替换
PropertyUtilsBean propertyUtilsBean = new CustPropertyUtilsBean();
ConvertUtilsBean convertUtilsBean = new CustConvertUtilsBean();
BeanUtilsBean beanUtilsBean = new BeanUtilsBean(convertUtilsBean,propertyUtilsBean);
BeanUtilsBean.setInstance(beanUtilsBean);
//注册转换器,处理枚举
registEnumConvert();
}
示例4: initBeanUtils
import org.apache.commons.beanutils.BeanUtilsBean; //导入方法依赖的package包/类
public static void initBeanUtils() {
// begin Kuali Foundation modification
ConvertUtilsBean convUtils = new ConvertUtilsBean();
PropertyUtilsBean propUtils = new PojoPropertyUtilsBean();
BeanUtilsBean pojoBeanUtils = new BeanUtilsBean(convUtils, propUtils);
BeanUtilsBean.setInstance(pojoBeanUtils);
logger.fine("Initialized BeanUtilsBean with " + pojoBeanUtils);
// end Kuali Foundation modification
}
示例5: setup
import org.apache.commons.beanutils.BeanUtilsBean; //导入方法依赖的package包/类
/**
* Perform CoerceUtil setup.
*/
private static void setup() {
BeanUtilsBean.setInstance(new BeanUtilsBean(new ConvertUtilsBean() {
{
// https://github.com/yahoo/elide/issues/260
// enable throwing exceptions when conversion fails
register(true, false, 0);
}
@Override
/*
* Overriding lookup to execute enum converter if target is enum
* or map convert if source is map
*/
public Converter lookup(Class<?> sourceType, Class<?> targetType) {
if (targetType.isEnum()) {
return TO_ENUM_CONVERTER;
} else if (targetType == UUID.class) {
return TO_UUID_CONVERTER;
}
else if (Map.class.isAssignableFrom(sourceType)) {
return FROM_MAP_CONVERTER;
} else if ((String.class.isAssignableFrom(sourceType) || Number.class.isAssignableFrom(sourceType))
&& ClassUtils.isAssignable(targetType, Date.class)) {
return EPOCH_TO_DATE_CONVERTER;
} else {
return super.lookup(sourceType, targetType);
}
}
}));
}
示例6: dispose
import org.apache.commons.beanutils.BeanUtilsBean; //导入方法依赖的package包/类
public void dispose() {
actionConfigs.clear();
actionConfigList.clear();
formBeans.clear();
BeanUtilsBean.setInstance(new BeanUtilsBean());
initialized = false;
}
示例7: initialize
import org.apache.commons.beanutils.BeanUtilsBean; //导入方法依赖的package包/类
@Override
public void initialize() {
BeanUtilsBean.setInstance(new CustomBeanUtilsBean());
messageResources.initialize();
}