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


Java ConvertUtilsBean类代码示例

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


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

示例1: afterPropertiesSet

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    beanContext = new BackendBeanContext(beanFactory);
    BeanContextBean.getInstance().setBeanContext(beanContext);
    VenusBeanUtilsBean.setInstance(new BackendBeanUtilsBean(new ConvertUtilsBean(), new PropertyUtilsBean(), beanContext));
    AthenaExtensionResolver.getInstance().resolver();
    CodeMapScanner.getCodeMap();

    List<ServiceConfig> serviceConfigList = new ArrayList<ServiceConfig>();
    Map<String, InterceptorMapping> interceptors = new HashMap<String, InterceptorMapping>();
    Map<String, InterceptorStackConfig> interceptorStacks = new HashMap<String, InterceptorStackConfig>();
    loadVenusService(serviceConfigList, interceptors, interceptorStacks);
    loadMonitorService(interceptors, interceptorStacks);
    loadRegistryService(interceptors, interceptorStacks);
    initMonitor(serviceConfigList, interceptors, interceptorStacks);
}
 
开发者ID:blusechen,项目名称:venus,代码行数:17,代码来源:XmlFileServiceManager.java

示例2: configureConvertUtilsBean

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
public static void configureConvertUtilsBean(
		ConvertUtilsBean convertUtilsBean, ResourceBundle resourceBundle) {

	convertUtilsBean.register(new QualquerObjetoParaString(resourceBundle),
			String.class);
	convertUtilsBean.register(new StringParaDataConverter(resourceBundle),
			Date.class);
	convertUtilsBean.register(
			new StringParaNumberConverter(resourceBundle), Double.class);
	convertUtilsBean.register(
			new StringParaNumberConverter(resourceBundle), Float.class);
	convertUtilsBean.register(
			new StringParaNumberConverter(resourceBundle), Integer.class);
	convertUtilsBean.register(
			new StringParaNumberConverter(resourceBundle), Long.class);
	convertUtilsBean.register(
			new StringParaNumberConverter(resourceBundle), Short.class);
	convertUtilsBean.register(
			new CollectionParaSetConverter(resourceBundle), Set.class);
	convertUtilsBean.register(new CollectionParaListConverter(
			resourceBundle), List.class);

}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:24,代码来源:FrameworkAcheUtil.java

示例3: registerConverters

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
public static void registerConverters(ConvertUtilsBean convertUtils,String[] datePatterns) {
	convertUtils.register(new StringConverter(), String.class);
	//date 
	convertUtils.register(ConvertRegisterHelper.setPatterns(new DateConverter(null),datePatterns),java.util.Date.class);
	convertUtils.register(ConvertRegisterHelper.setPatterns(new SqlDateConverter(null),datePatterns),java.sql.Date.class);
	convertUtils.register(ConvertRegisterHelper.setPatterns(new SqlTimeConverter(null),datePatterns),Time.class);
	convertUtils.register(ConvertRegisterHelper.setPatterns(new SqlTimestampConverter(null),datePatterns),Timestamp.class);
	//number
	convertUtils.register(new BooleanConverter(null), Boolean.class);
	convertUtils.register(new ShortConverter(null), Short.class);
	convertUtils.register(new IntegerConverter(null), Integer.class);
	convertUtils.register(new LongConverter(null), Long.class);
	convertUtils.register(new FloatConverter(null), Float.class);
	convertUtils.register(new DoubleConverter(null), Double.class);
	convertUtils.register(new BigDecimalConverter(null), BigDecimal.class); 
	convertUtils.register(new BigIntegerConverter(null), BigInteger.class);	
}
 
开发者ID:545473750,项目名称:zswxsqxt,代码行数:18,代码来源:ConvertRegisterHelper.java

示例4: getFileDataSource

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
public CsvReaderDataSource getFileDataSource(int csvVersion, DaTable table, String content, char dataDelimiter, String nullToken, Function<String, String> convertDbObjectName) {
    CsvReaderDataSource fileSource = new CsvReaderDataSource(csvVersion, "fileSource", new StringReader(content),
            dataDelimiter, convertDbObjectName, nullToken);
    ConvertUtilsBean cub = new ConvertUtilsBean();
    for (DaColumn col : table.getColumns()) {
        Class targetClassName;

        // This is to handle cases in Sybase ASE where a column comes back in quotes, e.g. "Date"
        // This happens if the column name happens to be a keyword, e.g. for Date
        String columnName = col.getName();
        if (columnName.startsWith("\"") && columnName.endsWith("\"")) {
            columnName = columnName.substring(1, columnName.length() - 1);
        }
        try {
            // this is to handle "tinyint"
            if (col.getColumnDataType().getTypeClassName().equalsIgnoreCase("byte")) {
                targetClassName = Integer.class;
            } else {
                targetClassName = Class.forName(col.getColumnDataType().getTypeClassName());
            }
        } catch (ClassNotFoundException e) {
            throw new DeployerRuntimeException(e);
        }
        fileSource.addDerivedField(new MyDerivedField(csvVersion, convertDbObjectName.valueOf(columnName),
                targetClassName, cub, nullToken));
    }

    fileSource.init();  // initialize so that we can discover the fields in the file
    return fileSource;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:31,代码来源:CsvStaticDataReader.java

示例5: MyDerivedField

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
public MyDerivedField(int csvVersion, String field, Class targetClass, ConvertUtilsBean cub, String nullToken) {
    this.csvVersion = csvVersion;
    this.field = field;
    this.cub = cub;
    this.targetClass = targetClass;
    this.nullToken = nullToken;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:8,代码来源:CsvStaticDataReader.java

示例6: convertWithDefault

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
private static Function<FieldToColumnMapping, String> convertWithDefault(final ConvertUtilsBean cub) {
    return new Function<FieldToColumnMapping, String>() {
        @Override
        public String valueOf(FieldToColumnMapping field) {
            return field.getColumnName() + " DEFAULT '" + cub.convert(field.getDefaultValue()) + "'";
        }
    };
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:9,代码来源:IqLoadFileCreator.java

示例7: createBeanUtilsBean

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
/**
 * Creates a BeanUtilsBean that is configured to use
 * type converters that throw a ConversionException
 * instead of using the default value when something
 * goes wrong.
 *
 * @return a configured BeanUtilsBean
 */
private static BeanUtilsBean createBeanUtilsBean() {
    final ConvertUtilsBean cub = new ConvertUtilsBean();

    registerIntegralTypes(cub);
    registerCustomTypes(cub);

    return new BeanUtilsBean(cub, new PropertyUtilsBean());
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:17,代码来源:AutomaticBean.java

示例8: registerIntegralTypes

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
/**
 * Register basic types of JDK like boolean, int, and String to use with BeanUtils. All these
 * types are found in the {@code java.lang} package.
 * @param cub
 *            Instance of {@link ConvertUtilsBean} to register types with.
 */
private static void registerIntegralTypes(ConvertUtilsBean cub) {
    cub.register(new BooleanConverter(), Boolean.TYPE);
    cub.register(new BooleanConverter(), Boolean.class);
    cub.register(new ArrayConverter(
        boolean[].class, new BooleanConverter()), boolean[].class);
    cub.register(new ByteConverter(), Byte.TYPE);
    cub.register(new ByteConverter(), Byte.class);
    cub.register(new ArrayConverter(byte[].class, new ByteConverter()),
        byte[].class);
    cub.register(new CharacterConverter(), Character.TYPE);
    cub.register(new CharacterConverter(), Character.class);
    cub.register(new ArrayConverter(char[].class, new CharacterConverter()),
        char[].class);
    cub.register(new DoubleConverter(), Double.TYPE);
    cub.register(new DoubleConverter(), Double.class);
    cub.register(new ArrayConverter(double[].class, new DoubleConverter()),
        double[].class);
    cub.register(new FloatConverter(), Float.TYPE);
    cub.register(new FloatConverter(), Float.class);
    cub.register(new ArrayConverter(float[].class, new FloatConverter()),
        float[].class);
    cub.register(new IntegerConverter(), Integer.TYPE);
    cub.register(new IntegerConverter(), Integer.class);
    cub.register(new ArrayConverter(int[].class, new IntegerConverter()),
        int[].class);
    cub.register(new LongConverter(), Long.TYPE);
    cub.register(new LongConverter(), Long.class);
    cub.register(new ArrayConverter(long[].class, new LongConverter()),
        long[].class);
    cub.register(new ShortConverter(), Short.TYPE);
    cub.register(new ShortConverter(), Short.class);
    cub.register(new ArrayConverter(short[].class, new ShortConverter()),
        short[].class);
    cub.register(new RelaxedStringArrayConverter(), String[].class);

    // BigDecimal, BigInteger, Class, Date, String, Time, TimeStamp
    // do not use defaults in the default configuration of ConvertUtilsBean
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:45,代码来源:AutomaticBean.java

示例9: registerCustomTypes

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
/**
 * Register custom types of JDK like URI and Checkstyle specific classes to use with BeanUtils.
 * None of these types should be found in the {@code java.lang} package.
 * @param cub
 *            Instance of {@link ConvertUtilsBean} to register types with.
 */
private static void registerCustomTypes(ConvertUtilsBean cub) {
    cub.register(new PatternConverter(), Pattern.class);
    cub.register(new SeverityLevelConverter(), SeverityLevel.class);
    cub.register(new ScopeConverter(), Scope.class);
    cub.register(new UriConverter(), URI.class);
    cub.register(new RelaxedAccessModifierArrayConverter(), AccessModifier[].class);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:14,代码来源:AutomaticBean.java

示例10: prepare

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
private static void prepare(){
	//使用自定义的替换
	PropertyUtilsBean propertyUtilsBean = new CustPropertyUtilsBean();
	ConvertUtilsBean convertUtilsBean = new CustConvertUtilsBean();
	
	BeanUtilsBean beanUtilsBean = new BeanUtilsBean(convertUtilsBean,propertyUtilsBean);
	BeanUtilsBean.setInstance(beanUtilsBean);
	
	//注册转换器,处理枚举
	registEnumConvert();
}
 
开发者ID:yinshipeng,项目名称:sosoapi-base,代码行数:12,代码来源:CustBeanPropUtils.java

示例11: initBeanUtils

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的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
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:PojoPlugin.java

示例12: register

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
/**
 * Register the conversion types.
 *
 * @param convertUtilsBean registrar.
 */
@Override
public void register(ConvertUtilsBean convertUtilsBean) {
    convertUtilsBean.deregister(String.class);
    convertUtilsBean.deregister(Calendar.class);
    convertUtilsBean.deregister(Date.class);
    convertUtilsBean.register(this, String.class);
    convertUtilsBean.register(this, Calendar.class);
    convertUtilsBean.register(this, Date.class);
}
 
开发者ID:ZenHarbinger,项目名称:torgo,代码行数:15,代码来源:DateConverter.java

示例13: register

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
/**
 * Register the conversion types.
 *
 * @param convertUtilsBean registrar.
 */
@Override
public void register(ConvertUtilsBean convertUtilsBean) {
    convertUtilsBean.deregister(String.class);
    convertUtilsBean.deregister(Color.class);
    convertUtilsBean.register(this, String.class);
    convertUtilsBean.register(this, Color.class);
}
 
开发者ID:ZenHarbinger,项目名称:torgo,代码行数:13,代码来源:ColorConverter.java

示例14: setup

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的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);
            }
        }
    }));
}
 
开发者ID:yahoo,项目名称:elide,代码行数:34,代码来源:CoerceUtil.java

示例15: getArgumentValues

import org.apache.commons.beanutils.ConvertUtilsBean; //导入依赖的package包/类
/**
 * @return Returns the argumentValues.
 * @throws PopUpControllerException
 */
protected Object[] getArgumentValues() throws PopUpControllerException {
	Object[] argumentValues = new Object[arguments.size()];

	Iterator iterator = arguments.iterator();
	int i = 0;
	while (iterator.hasNext()) {
		PopUpArgument popUpArgument = (PopUpArgument) iterator.next();

		/* valor em formato String */
		String value = popUpArgument.getValue();
		/* tipo do valor */
		Class type = popUpArgument.getArgumentType();

		/* CRIANDO UM OBJETO ConvertUtilsBean */
		ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean();

		/* Configura um ConvertUtilsBean j� criado */
		FrameworkAcheUtil.configureConvertUtilsBean(convertUtilsBean,
				getResourceBundle());

		/* INVOCANDO CONVERS�O */
		Object objectValue = convertUtilsBean.convert(value, type);

		/* ATRIBUINDO AA LISTA DE ARGUMENTOS */
		argumentValues[i++] = objectValue;
	}

	return argumentValues;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:34,代码来源:PopUpController.java


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