Java Code Examples for java.beans.IndexedPropertyDescriptor#getWriteMethod()

The following examples show how to use java.beans.IndexedPropertyDescriptor#getWriteMethod() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test4634390.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
    }
}
 
Example 2
Source File: Test4634390.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
    }
}
 
Example 3
Source File: Test4634390.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
    }
}
 
Example 4
Source File: Test4634390.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
    }
}
 
Example 5
Source File: Test4634390.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
    }
}
 
Example 6
Source File: Test4634390.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
    }
}
 
Example 7
Source File: Test4634390.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
    }
}
 
Example 8
Source File: Test4619536.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 9
Source File: ExtendedBeanInfo.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
 
Example 10
Source File: ExtendedBeanInfo.java    From blog_demos with Apache License 2.0 4 votes vote down vote up
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	copyNonMethodProperties(original, this);
}
 
Example 11
Source File: Test4619536.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 12
Source File: Test4619536.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 13
Source File: Test4619536.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 14
Source File: Test4619536.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 15
Source File: Test4619536.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 16
Source File: Test4619536.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 17
Source File: ExtendedBeanInfo.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
 
Example 18
Source File: ExtendedBeanInfo.java    From java-technology-stack with MIT License 4 votes vote down vote up
public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throws IntrospectionException {
	this(original.getName(), original.getReadMethod(), original.getWriteMethod(),
			original.getIndexedReadMethod(), original.getIndexedWriteMethod());
	PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
 
Example 19
Source File: Test4619536.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 20
Source File: Test4619536.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}