java.beans.IndexedPropertyDescriptor#getWriteMethod ( )源码实例Demo

下面列出了java.beans.IndexedPropertyDescriptor#getWriteMethod ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: Test4634390.java
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;
    }
}
 
源代码2 项目: TencentKona-8   文件: Test4634390.java
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;
    }
}
 
源代码3 项目: openjdk-jdk8u   文件: Test4634390.java
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;
    }
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: Test4634390.java
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;
    }
}
 
源代码5 项目: jdk8u-dev-jdk   文件: Test4634390.java
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;
    }
}
 
源代码6 项目: jdk8u-jdk   文件: Test4634390.java
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;
    }
}
 
源代码7 项目: jdk8u_jdk   文件: Test4634390.java
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;
    }
}
 
源代码8 项目: spring-analysis-note   文件: ExtendedBeanInfo.java
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
 
源代码9 项目: jdk8u-jdk   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码10 项目: TencentKona-8   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码11 项目: java-technology-stack   文件: ExtendedBeanInfo.java
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
 
源代码12 项目: spring4-understanding   文件: ExtendedBeanInfo.java
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
 
源代码13 项目: jdk8u60   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码14 项目: openjdk-jdk8u   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码15 项目: openjdk-8-source   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码17 项目: openjdk-jdk9   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码18 项目: jdk8u-jdk   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}
 
源代码19 项目: blog_demos   文件: ExtendedBeanInfo.java
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	copyNonMethodProperties(original, this);
}
 
源代码20 项目: openjdk-8   文件: Test4619536.java
public static void main(String[] args) throws Exception {
    IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo");
    if (!ipd.getIndexedPropertyType().equals(String.class)) {
        error(ipd, "A.foo should be String type");
    }
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "B.foo should not be an indexed property");
    }
    if (!pd.getPropertyType().equals(Date.class)) {
        error(pd, "B.foo should be Date type");
    }
    pd = BeanUtils.findPropertyDescriptor(Child.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Child.foo should not be an indexed property");
    }
    pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo");
    if (pd instanceof IndexedPropertyDescriptor) {
        error(pd, "Classic.foo should not be an indexed property");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo");
    if (!hasIPD(ipd)) {
        error(pd, "Index.foo should have ipd values");
    }
    if (hasPD(ipd)) {
        error(ipd, "Index.foo should not have pd values");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo");
    if (!hasPD(ipd) || !hasIPD(ipd)) {
        error(ipd, "All.foo should have all pd/ipd values");
    }
    if (!isValidType(ipd)) {
        error(ipd, "All.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo");
    if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
        error(ipd, "Getter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Getter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadGetter.foo should not have classic methods");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo");
    if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
        error(ipd, "Setter.foo classic methods incorrect");
    }
    if (!isValidType(ipd)) {
        error(ipd, "Setter.foo pdType should equal ipdType");
    }
    ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo");
    if (hasPD(ipd)) {
        error(ipd, "BadSetter.foo should not have classic methods");
    }
}