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


Java BeanUtil.hasProperty方法代码示例

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


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

示例1: getFeatures

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
/** Provides a {@link Map} of all properties and public attributes of a class assigned to their Java type.
 * @param type the Java class to examine
 * @return a {@link Map} of all properties and public attributes of a class assigned to their Java type */
public static Map<String, Class<?>> getFeatures(Class<?> type) {
    Map<String, Class<?>> features = new OrderedMap<String, Class<?>>();
    for (Field field : type.getDeclaredFields()) {
        if (WizardUtil.isPublic(field) || BeanUtil.hasProperty(type, field.getName())) {
            features.put(field.getName(), field.getType());
        }
    }
    return features;
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:13,代码来源:WizardUtil.java

示例2: parseRestrictionChildren

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
private void parseRestrictionChildren(Element restriction,
		SimpleTypeDescriptor descriptor) {
	Element[] children = XMLUtil.getChildElements(restriction);
       for (Element child : children) {
           String nodeName = localName(child);
           String value = child.getAttribute(VALUE);
           if (ENUMERATION.equals(nodeName)) {
           	if (PrimitiveType.STRING.equals(descriptor.getPrimitiveType()))
           		descriptor.addValue("'" + value + "'");
           	else
           		descriptor.addValue(value);
           } else if (MIN_INCLUSIVE.equals(nodeName)) {
               descriptor.setMin(value);
               descriptor.setMinInclusive(true);
           } else if (MIN_EXCLUSIVE.equals(nodeName)) {
               descriptor.setMin(value);
               descriptor.setMinInclusive(false);
           } else if (MAX_INCLUSIVE.equals(nodeName)) {
               descriptor.setMax(value);
               descriptor.setMaxInclusive(true);
           } else if (MAX_EXCLUSIVE.equals(nodeName)) {
               descriptor.setMax(value);
               descriptor.setMaxInclusive(false);
           } else if (LENGTH.equals(nodeName)) {
               int length = Integer.parseInt(value);
               descriptor.setMinLength(length);
               descriptor.setMaxLength(length);
           } else if (BeanUtil.hasProperty(descriptor.getClass(), nodeName)) {
               BeanUtil.setPropertyValue(descriptor, nodeName, value, false);
           } else
               LOGGER.warn("Ignoring restriction " + nodeName + ": " + value);
       }
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:34,代码来源:XMLSchemaDescriptorProvider.java

示例3: createConvertingGenerator

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Generator<?> createConvertingGenerator(TypeDescriptor descriptor,
           Generator<?> generator, BeneratorContext context) {
       Converter<?, ?> converter = DescriptorUtil.getConverter(descriptor.getConverter(), context);
       if (converter != null) {
           if (descriptor.getPattern() != null && BeanUtil.hasProperty(converter.getClass(), PATTERN))
               BeanUtil.setPropertyValue(converter, PATTERN, descriptor.getPattern(), false);
           return WrapperFactory.applyConverter((Generator) generator, converter);
       }
       return generator;
   }
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:12,代码来源:DescriptorUtil.java

示例4: createConvertingGenerator

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Generator<?> createConvertingGenerator(TypeDescriptor descriptor, Generator generator, BeneratorContext context) {
    Converter<?,?> converter = DescriptorUtil.getConverter(descriptor.getConverter(), context);
    if (converter != null) {
        if (descriptor.getPattern() != null && BeanUtil.hasProperty(converter.getClass(), PATTERN)) {
            BeanUtil.setPropertyValue(converter, PATTERN, descriptor.getPattern(), false);
        }
        generator = WrapperFactory.applyConverter(generator, converter);
    }
    return generator;
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:12,代码来源:TypeGeneratorFactory.java

示例5: setBeanProperty

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
public static void setBeanProperty(Object bean, String detailName, Object detailValue, Context context) {
    if (detailValue != null && BeanUtil.hasProperty(bean.getClass(), detailName)) {
        try {
            PropertyDescriptor propertyDescriptor = BeanUtil.getPropertyDescriptor(bean.getClass(), detailName);
            Class<?> propertyType = propertyDescriptor.getPropertyType();
            Object propertyValue = detailValue;
            if (detailValue instanceof String && StorageSystem.class.isAssignableFrom(propertyType))
                propertyValue = context.get(propertyValue.toString());
            BeanUtil.setPropertyValue(bean, detailName, propertyValue, false);
        } catch (RuntimeException e) {
            throw new RuntimeException("Error setting '" + detailName + "' of class " + bean.getClass().getName(), e); 
        }
    }
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:15,代码来源:FactoryUtil.java

示例6: createConvertingGenerator

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
public static Generator<?> createConvertingGenerator(TypeDescriptor descriptor, Generator<?> generator, BeneratorContext context) {
    Converter<?,?> converter = DescriptorUtil.getConverter(descriptor.getConverter(), context);
    if (converter != null) {
        if (descriptor.getPattern() != null && BeanUtil.hasProperty(converter.getClass(), PATTERN)) {
            BeanUtil.setPropertyValue(converter, PATTERN, descriptor.getPattern(), false);
        }
        generator = DescriptorUtil.createConvertingGenerator(descriptor, generator, context);
    }
    return generator;
}
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:11,代码来源:VariableGeneratorFactory.java


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