JaxbJXPathBeanInfo.java 文件源码

java
阅读 112 收藏 0 点赞 0 评论 0

项目:jxpath-object-formatter 作者:
private static int getPropertyOrder(final Map<String, Integer> propMap, final Class<?> beanClass, final int offset) {
    int index = offset;
    if (beanClass.getSuperclass() != null) {
        index = getPropertyOrder(propMap, beanClass.getSuperclass(), offset);
    }
    final XmlType xmlTypeAnnotation = beanClass.getAnnotation(XmlType.class);
    if (xmlTypeAnnotation != null && xmlTypeAnnotation.propOrder() != null && !xmlTypeAnnotation.propOrder()[0].isEmpty()) {
        for (final String propName : xmlTypeAnnotation.propOrder()) {
            propMap.put(propName, index++);
        }
    } else {
        try {
            final BeanInfo beanInfo = Introspector.getBeanInfo(beanClass, beanClass.getSuperclass());
            for (final PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) {
                propMap.put(propertyDescriptor.getName(), index++);
            }
        } catch (final IntrospectionException e) {
            throw new JXPathException(e);
        }
    }
    return index;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号