Class BeanInfoGen


  • public final class BeanInfoGen
    extends java.lang.Object
    Generates the Java source of an explicit java.beans.BeanInfo class for a bean class. By default the generated BeanInfo fully replicates the information that ordinary introspection would have produced in the absence of any explicit BeanInfo for the bean class -- its bean descriptor, property descriptors, event-set descriptors and method descriptors. Properties may be excluded from the generated property descriptors in two ways: by name (any property whose name appears in excludedPropertyNames) and by type (any property whose type is assignable to one of the Class objects in excludedPropertyTypes). For an indexed property, exclusion by type considers both the array type and the element type, independent of which accessor convention defined the property (an array-valued accessor such as String[] getTags(), a single-index accessor such as String getTags(int), or both). Whichever of the two types the property descriptor does not directly report is derived from the other, and the property is excluded if either is assignable to an excluded type. Thus an indexed property with element type String is excluded whether String.class or String[].class is given, and identically regardless of how it was declared. Because the generated getPropertyDescriptors() returns a non-null array, the JavaBeans Introspector uses it verbatim rather than rediscovering properties reflectively, so the accessor methods of an excluded property are no longer seen as constituting a JavaBeans property. The methods themselves remain ordinary public methods and are still reported among the method descriptors.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String explicitBeanInfoClassSourceForBeanClass​(java.lang.Class beanClass, java.util.Set excludedPropertyNames, java.util.Set excludedPropertyTypes)  
      static void main​(java.lang.String[] argv)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • explicitBeanInfoClassSourceForBeanClass

        public static java.lang.String explicitBeanInfoClassSourceForBeanClass​(java.lang.Class beanClass,
                                                                               java.util.Set excludedPropertyNames,
                                                                               java.util.Set excludedPropertyTypes)
                                                                        throws java.beans.IntrospectionException,
                                                                               java.io.IOException
        Throws:
        java.beans.IntrospectionException
        java.io.IOException
      • main

        public static void main​(java.lang.String[] argv)