Java Code Examples for java.beans.PropertyDescriptor#getPropertyEditorClass()

The following examples show how to use java.beans.PropertyDescriptor#getPropertyEditorClass() . 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: CachedIntrospectionResults.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class<?> beanClass, PropertyDescriptor pd) {
	try {
		return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(),
				pd.getWriteMethod(), pd.getPropertyEditorClass());
	}
	catch (IntrospectionException ex) {
		throw new FatalBeanException("Failed to re-introspect class [" + beanClass.getName() + "]", ex);
	}
}
 
Example 2
Source File: GenericValueConverter.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates a new value converter.
 */
public GenericValueConverter( final PropertyDescriptor pd ) throws IntrospectionException {
  if ( pd == null ) {
    throw new NullPointerException( "PropertyDescriptor must not be null." );
  }
  if ( pd.getPropertyEditorClass() == null ) {
    throw new IntrospectionException( "Property has no editor." );
  }
  this.propertyDescriptor = pd;
  this.propertyEditor = createPropertyEditor( pd );
}
 
Example 3
Source File: Test4634390.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 4
Source File: Test4634390.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 5
Source File: Test4634390.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 6
Source File: Test4634390.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 7
Source File: Test4634390.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 8
Source File: Test4634390.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 9
Source File: GenericValueConverter.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private PropertyEditor createPropertyEditor( final PropertyDescriptor pi ) throws IntrospectionException {
  final Class c = pi.getPropertyEditorClass();
  try {
    return (PropertyEditor) c.newInstance();
  } catch ( Exception e ) {
    throw new IntrospectionException( "Unable to create PropertyEditor." );
  }
}
 
Example 10
Source File: CachedIntrospectionResults.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class<?> beanClass, PropertyDescriptor pd) {
	try {
		return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(),
				pd.getWriteMethod(), pd.getPropertyEditorClass());
	}
	catch (IntrospectionException ex) {
		throw new FatalBeanException("Failed to re-introspect class [" + beanClass.getName() + "]", ex);
	}
}
 
Example 11
Source File: Test4634390.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 12
Source File: Test4634390.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 13
Source File: Test4634390.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 14
Source File: CachedIntrospectionResults.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class<?> beanClass, PropertyDescriptor pd) {
	try {
		return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(),
				pd.getWriteMethod(), pd.getPropertyEditorClass());
	}
	catch (IntrospectionException ex) {
		throw new FatalBeanException("Failed to re-introspect class [" + beanClass.getName() + "]", ex);
	}
}
 
Example 15
Source File: Test4634390.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 16
Source File: Test4634390.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 17
Source File: CachedIntrospectionResults.java    From java-technology-stack with MIT License 5 votes vote down vote up
private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class<?> beanClass, PropertyDescriptor pd) {
	try {
		return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(),
				pd.getWriteMethod(), pd.getPropertyEditorClass());
	}
	catch (IntrospectionException ex) {
		throw new FatalBeanException("Failed to re-introspect class [" + beanClass.getName() + "]", ex);
	}
}
 
Example 18
Source File: Test4634390.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 19
Source File: Test4634390.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
    if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
        System.out.println("read methods not equal");
        return false;
    }
    if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
        System.out.println("write methods not equal");
        return false;
    }
    if (pd1.getPropertyType() != pd2.getPropertyType()) {
        System.out.println("property type not equal");
        return false;
    }
    if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
        System.out.println("property editor class not equal");
        return false;
    }
    if (pd1.isBound() != pd2.isBound()) {
        System.out.println("bound value not equal");
        return false;
    }
    if (pd1.isConstrained() != pd2.isConstrained()) {
        System.out.println("constrained value not equal");
        return false;
    }
    return true;
}
 
Example 20
Source File: PropertyUtilsBean.java    From commons-beanutils with Apache License 2.0 4 votes vote down vote up
/**
 * <p>Return the Java Class repesenting the property editor class that has
 * been registered for this property (if any).  This method follows the
 * same name resolution rules used by {@code getPropertyDescriptor()},
 * so if the last element of a name reference is indexed, the property
 * editor for the underlying property's class is returned.</p>
 *
 * <p>Note that {@code null} will be returned if there is no property,
 * or if there is no registered property editor class.  Because this
 * return value is ambiguous, you should determine the existence of the
 * property itself by other means.</p>
 *
 * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p>
 *
 * @param bean Bean for which a property descriptor is requested
 * @param name Possibly indexed and/or nested name of the property for
 *  which a property descriptor is requested
 * @return the property editor class
 *
 * @throws IllegalAccessException if the caller does not have
 *  access to the property accessor method
 * @throws IllegalArgumentException if {@code bean} or
 *  {@code name} is null
 * @throws IllegalArgumentException if a nested reference to a
 *  property returns null
 * @throws InvocationTargetException if the property accessor method
 *  throws an exception
 * @throws NoSuchMethodException if an accessor method for this
 *  property cannot be found
 */
public Class<?> getPropertyEditorClass(final Object bean, final String name)
        throws IllegalAccessException, InvocationTargetException,
        NoSuchMethodException {

    if (bean == null) {
        throw new IllegalArgumentException("No bean specified");
    }
    if (name == null) {
        throw new IllegalArgumentException("No name specified for bean class '" +
                bean.getClass() + "'");
    }

    final PropertyDescriptor descriptor =
            getPropertyDescriptor(bean, name);
    if (descriptor != null) {
        return descriptor.getPropertyEditorClass();
    }
    return null;

}