Java 8 IntrospectionException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 IntrospectionException class.

This code example shows how to use the following methods:
			if (params.length != 0) {
				throw new IntrospectionException("Bad read method arg count: " + readMethod);
			} 
			propertyType = readMethod.getReturnType();
			if (propertyType == Void.TYPE) {
				throw new IntrospectionException("Read method returns void: " + readMethod);
			} 
		} 
 
		if (writeMethod != null) {
			Class<?> params[] = writeMethod.getParameterTypes();
			if (params.length != 1) {
				throw new IntrospectionException("Bad write method arg count: " + writeMethod);
			} 
			if (propertyType != null) {
				if (propertyType.isAssignableFrom(params[0])) {
					// Write method's property type potentially more specific 
					propertyType = params[0];
				} 
				else if (params[0].isAssignableFrom(propertyType)) {
6
CodeRank
This code example shows how to use the following methods:
 * used within Spring {@code <beans>} XML. {@link #getPropertyDescriptors()} returns all 
 * existing property descriptors from the wrapped {@code BeanInfo} as well any added for 
 * non-void returning setters. Both standard ("non-indexed") and 
 * <a href="http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html"> 
 * indexed properties</a> are fully supported. 
 * 
 * @author Chris Beams 
 * @since 3.1 
 * @see #ExtendedBeanInfo(BeanInfo) 
 * @see ExtendedBeanInfoFactory 
 * @see CachedIntrospectionResults 
 */ 
class ExtendedBeanInfo implements BeanInfo {
 
	private static final Log logger = LogFactory.getLog(ExtendedBeanInfo.class);
 
	private final BeanInfo delegate;
 
	private final Set<PropertyDescriptor> propertyDescriptors =
			new TreeSet<PropertyDescriptor>(new PropertyDescriptorComparator());
5
CodeRank
This code example shows how to use the following methods:toString
 
        // Get the beanInfo: 
        try { 
            beanInfo = Introspector.getBeanInfo(testBeanClass);
        } catch (IntrospectionException e) {
            log.error("Can't get beanInfo for " + testBeanClass.getName(), e);
            throw new Error(e.toString()); // Programming error. Don't
                                            // continue. 
        } 
 
        customizerClass = beanInfo.getBeanDescriptor().getCustomizerClass();
 
        // Creation of the customizer and GUI initialization is delayed until 
        // the 
        // first 
        // configure call. We don't need all that just to find out the static 
        // label, menu 
        // categories, etc! 
        initialized = false;
        JMeterUtils.addLocaleChangeListener(this);
5
CodeRank
This code example shows how to use the following methods:getMessage
        try { 
            BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
 
            descriptors = beanInfo.getPropertyDescriptors();
        } catch (IntrospectionException e) {
            LOGGER.error(e.getMessage(), e);
        } 
 
        if (descriptors == null) {
            descriptors = EMPTY_DESCRIPTORS_ARRAY;
        } 
 
        return descriptors;
    } 
 
    public static Object readPropertyValue(Object bean, PropertyDescriptor descriptor) throws Exception {
        Method readMethod = descriptor.getReadMethod();
 
        if (readMethod == null) {
            throw new NoSuchMethodException(MessageFormat.format("Read method for property ''{0}'' not found",
5
CodeRank
This code example shows how to use the following methods:
    { 
      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);
  } 
 
  private PropertyEditor createPropertyEditor(final PropertyDescriptor pi)
      throws IntrospectionException
  { 
    final Class c = pi.getPropertyEditorClass();
    try 
    { 
      return (PropertyEditor) c.newInstance();
    } 
    catch (Exception e)
4
CodeRank
This code example shows how to use the following methods:printStackTrace
		this.wrappedInstance = obj;
		try { 
			this.beanInfo = this.wrappedInstance ==null?null:Introspector.getBeanInfo(this.wrappedInstance.getClass());
		} catch (IntrospectionException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
	} 
	 
 
	/** 
	 * Return the bean instance wrapped by this object, if any. 
	 * @return the bean instance, or <code>null</code> if none set 
	 */ 
	public Object getWrappedInstance() 
	{ 
		return this.wrappedInstance;
	} 
 
	/** 
4
CodeRank
This code example shows how to use the following methods:getClass, getMessage
      return new TypedPropertyDescriptor( propertyName, beanClass, getterName, setterName );
    } 
    catch( IntrospectionException e )
    { 
      throw new RuntimeException( "Failed to create property \"" + propertyName + "\" on class \"" + beanClass +
                                  "\": " + e.getClass() + " - " + e.getMessage() );
    } 
  } 
} 
4
CodeRank
This code example shows how to use the following methods:getMessage
        try { 
            beanInfo = Introspector.getBeanInfo(c);
 
        } catch (IntrospectionException e) {
            throw new SQLException(
                "Bean introspection failed: " + e.getMessage());
        } 
 
        return beanInfo.getPropertyDescriptors();
    } 
 
    /** 
     * The positions in the returned array represent column numbers.  The  
     * values stored at each position represent the index in the  
     * <code>PropertyDescriptor[]</code> for the bean property that matches  
     * the column name.  If no bean property was found for a column, the  
     * position is set to <code>PROPERTY_NOT_FOUND</code>. 
     *  
     * @param rsmd The <code>ResultSetMetaData</code> containing column  
     * information. 
3
CodeRank
This code example shows how to use the following methods:
                    throw new IntrospectionException
                            ("bad mapped read method arg count"); 
                } 
                mappedPropertyType = mappedReadMethod.getReturnType();
                if (mappedPropertyType == Void.TYPE) {
                    throw new IntrospectionException
                            ("mapped read method " + 
                            mappedReadMethod.getName() + " returns void");
                } 
            } 
 
            if (mappedWriteMethod != null) {
                final Class<?>[] params = mappedWriteMethod.getParameterTypes();
                if (params.length != 2) {
                    throw new IntrospectionException
                            ("bad mapped write method arg count"); 
                } 
                if (mappedPropertyType != null &&
                        mappedPropertyType != params[1]) {
                    throw new IntrospectionException
3
CodeRank
This code example shows how to use the following methods:getMessage
        super(propertyName);
        PropertyDescriptor descriptor;
        try { 
            descriptor = new PropertyDescriptor(propertyName, beanType);
        } catch (IntrospectionException ex) {
            throw new NoSuchFieldError("Invalid property: " + propertyName + ": " + ex.getMessage());
        } 
        Method readMethod = descriptor.getReadMethod();
        Method writeMethod = descriptor.getWriteMethod();
        if (readMethod == null && writeMethod == null) {
            throw new NoSuchFieldError("Invalid property: " + propertyName + ": Both read and write methods are missing");
        } 
        this.declaringType = (readMethod != null ? readMethod.getDeclaringClass() : writeMethod.getDeclaringClass());
        this.propertyType = (Class<P>) descriptor.getPropertyType();
        this.readMethod = readMethod;
        this.writeMethod = writeMethod;
    } 
 
    /** 
     * Sets the meta-bean, necessary due to ordering restrictions during loading. 
3
CodeRank
See Code Examples for Java 8 IntrospectionException Methods: