java类java.beans.IndexedPropertyDescriptor的实例源码

BeanNodeBug21285.java 文件源码 项目:incubator-netbeans 阅读 15 收藏 0 点赞 0 评论 0
public static void main(String[] args)throws Exception {


        BeanInfo bi = Introspector.getBeanInfo( BadBeanHidden.class );
        PropertyDescriptor[] ps = bi.getPropertyDescriptors();

        for ( int i = 0; i < ps.length; i++ ) {
            System.out.println( i + " : " + ps[i]);
            System.out.println("  Read : " + ps[i].getReadMethod() );
            System.out.println("  Write : " + ps[i].getWriteMethod() );
            System.out.println(" TYPE " + ps[i].getPropertyType() );
            if ( ps[i] instanceof IndexedPropertyDescriptor ) {
                System.out.println("  I Read : " + ((IndexedPropertyDescriptor)ps[i]).getIndexedReadMethod() );
                System.out.println("  I Write : " +((IndexedPropertyDescriptor)ps[i]).getIndexedWriteMethod() );
                System.out.println(" TYPE " + ((IndexedPropertyDescriptor)ps[i]).getIndexedPropertyType() );
            }


        }
    }
JavaIntrospector.java 文件源码 项目:myfaces-trinidad 阅读 28 收藏 0 点赞 0 评论 0
private static IndexedPropertyDescriptor _cloneIndexedPropertyDescriptor(
  IndexedPropertyDescriptor oldDescriptor
  )
{
  try
  {
    IndexedPropertyDescriptor newDescriptor = new IndexedPropertyDescriptor(
                                    oldDescriptor.getName(),
                                    oldDescriptor.getReadMethod(),
                                    oldDescriptor.getWriteMethod(),
                                    oldDescriptor.getIndexedReadMethod(),
                                    oldDescriptor.getIndexedWriteMethod());

    // copy the rest of the attributes
    _copyPropertyDescriptor(oldDescriptor, newDescriptor);

    return newDescriptor;
  }
  catch (Exception e)
  {
    _LOG.severe(e);
    return null;
  }
}
ExtendedBeanInfo.java 文件源码 项目:lams 阅读 26 收藏 0 点赞 0 评论 0
private PropertyDescriptor findExistingPropertyDescriptor(String propertyName, Class<?> propertyType) {
    for (PropertyDescriptor pd : this.propertyDescriptors) {
        final Class<?> candidateType;
        final String candidateName = pd.getName();
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            candidateType = ipd.getIndexedPropertyType();
            if (candidateName.equals(propertyName) &&
                    (candidateType.equals(propertyType) || candidateType.equals(propertyType.getComponentType()))) {
                return pd;
            }
        }
        else {
            candidateType = pd.getPropertyType();
            if (candidateName.equals(propertyName) &&
                    (candidateType.equals(propertyType) || propertyType.equals(candidateType.getComponentType()))) {
                return pd;
            }
        }
    }
    return null;
}
ExtendedBeanInfo.java 文件源码 项目:lams 阅读 22 收藏 0 点赞 0 评论 0
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj != null && obj instanceof IndexedPropertyDescriptor) {
        IndexedPropertyDescriptor other = (IndexedPropertyDescriptor) obj;
        if (!compareMethods(getIndexedReadMethod(), other.getIndexedReadMethod())) {
            return false;
        }
        if (!compareMethods(getIndexedWriteMethod(), other.getIndexedWriteMethod())) {
            return false;
        }
        if (getIndexedPropertyType() != other.getIndexedPropertyType()) {
            return false;
        }
        return PropertyDescriptorUtils.equals(this, obj);
    }
    return false;
}
ObjectWrapper.java 文件源码 项目:etomica 阅读 16 收藏 0 点赞 0 评论 0
private static Property makeProperty(Object o, PropertyDescriptor propertyDescriptor) {
    Class propertyType = propertyDescriptor.getPropertyType();
    if (propertyType != null && Vector.class.isAssignableFrom(propertyType)) {
        return new VectorProperty(o, propertyDescriptor);
    }
    if (propertyType != null && IAtomList.class.isAssignableFrom(propertyType)) {
        return new AtomListProperty(o, propertyDescriptor);
    }
    if (propertyType != null && IMoleculeList.class.isAssignableFrom(propertyType)) {
        return new MoleculeListProperty(o, propertyDescriptor);
    }
    if (!(propertyDescriptor instanceof IndexedPropertyDescriptor) && propertyType.isArray() &&
            !(propertyType.getComponentType().isPrimitive() || propertyType.getComponentType().equals(String.class))) {
        return new ArrayProperty(o, propertyDescriptor);
    }
    return new InstanceProperty(o, propertyDescriptor);
}
Test4634390.java 文件源码 项目:jdk8u-jdk 阅读 15 收藏 0 点赞 0 评论 0
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
Test8034164.java 文件源码 项目:jdk8u-jdk 阅读 16 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test8034085.java 文件源码 项目:jdk8u-jdk 阅读 14 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test6976577.java 文件源码 项目:jdk8u-jdk 阅读 24 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
Test4634390.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
Test8034164.java 文件源码 项目:openjdk-jdk10 阅读 15 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test8034085.java 文件源码 项目:openjdk-jdk10 阅读 14 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test6976577.java 文件源码 项目:openjdk-jdk10 阅读 21 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
Test4634390.java 文件源码 项目:openjdk9 阅读 21 收藏 0 点赞 0 评论 0
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
Test8034164.java 文件源码 项目:openjdk9 阅读 15 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test8034085.java 文件源码 项目:openjdk9 阅读 13 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test6976577.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
ExtendedBeanInfo.java 文件源码 项目:spring4-understanding 阅读 22 收藏 0 点赞 0 评论 0
private PropertyDescriptor findExistingPropertyDescriptor(String propertyName, Class<?> propertyType) {
    for (PropertyDescriptor pd : this.propertyDescriptors) {
        final Class<?> candidateType;
        final String candidateName = pd.getName();
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            candidateType = ipd.getIndexedPropertyType();
            if (candidateName.equals(propertyName) &&
                    (candidateType.equals(propertyType) || candidateType.equals(propertyType.getComponentType()))) {
                return pd;
            }
        }
        else {
            candidateType = pd.getPropertyType();
            if (candidateName.equals(propertyName) &&
                    (candidateType.equals(propertyType) || propertyType.equals(candidateType.getComponentType()))) {
                return pd;
            }
        }
    }
    return null;
}
Test4634390.java 文件源码 项目:jdk8u_jdk 阅读 21 收藏 0 点赞 0 评论 0
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
Test8034164.java 文件源码 项目:jdk8u_jdk 阅读 14 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test8034085.java 文件源码 项目:jdk8u_jdk 阅读 16 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test6976577.java 文件源码 项目:jdk8u_jdk 阅读 21 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
Test4634390.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 17 收藏 0 点赞 0 评论 0
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
Test8034164.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 15 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test8034085.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 16 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test6976577.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
ExtendedBeanInfo.java 文件源码 项目:spring 阅读 29 收藏 0 点赞 0 评论 0
private PropertyDescriptor findExistingPropertyDescriptor(String propertyName, Class<?> propertyType) {
    for (PropertyDescriptor pd : this.propertyDescriptors) {
        final Class<?> candidateType;
        final String candidateName = pd.getName();
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            candidateType = ipd.getIndexedPropertyType();
            if (candidateName.equals(propertyName) &&
                    (candidateType.equals(propertyType) || candidateType.equals(propertyType.getComponentType()))) {
                return pd;
            }
        }
        else {
            candidateType = pd.getPropertyType();
            if (candidateName.equals(propertyName) &&
                    (candidateType.equals(propertyType) || propertyType.equals(candidateType.getComponentType()))) {
                return pd;
            }
        }
    }
    return null;
}
Test4634390.java 文件源码 项目:infobip-open-jdk-8 阅读 23 收藏 0 点赞 0 评论 0
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
Test8034164.java 文件源码 项目:infobip-open-jdk-8 阅读 16 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
Test8034085.java 文件源码 项目:infobip-open-jdk-8 阅读 16 收藏 0 点赞 0 评论 0
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号