Class BeanUtils


  • public final class BeanUtils
    extends java.lang.Object
    Java Beans utility methods
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  BeanUtils.PropertiesEditor
      Properties editor panel.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_NODE_PROPERTY_VALUE
      Attribute name to hold default property value in descriptor.
      static java.lang.Object DEFAULT_NODE_PROPERTY_VALUE_NULL
      Special value to mark properties where default value is null.
      static java.lang.String NULL_VALUE_TEXT
      Attribute name for expression that is displayed instead of null by the property editor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.openide.nodes.BeanNode.Descriptor computeProperties​(java.lang.Object bean, java.beans.BeanInfo info)
      Extension to a descriptor computation to support properties that can be reverted to default value.
      static java.beans.BeanInfo findBeanInfo​(java.lang.Object bean)
      Use this method when finding bean info for any bean.
      static java.beans.Customizer findCustomizer​(java.lang.Object bean)  
      static java.lang.Class<? extends java.beans.Customizer> findCustomizerClass​(java.lang.Class clazz)
      Finds customizer for class.
      static javax.swing.JComponent findUICustomizer​(java.lang.Object bean)  
      static javax.swing.JComponent findUICustomizer​(java.lang.Object bean, boolean setObject)  
      static boolean hasUICustomizer​(java.lang.Object bean)  
      static boolean openPropertySheetForNode​(org.openide.nodes.Node... nodes)
      Open the dialog with property sheet.
      static java.beans.PropertyEditor propertyEditorWithNullValue​(java.beans.PropertyEditor delegate, java.lang.String nullValue)
      Creates delegating property editor that displays passed string as a representation of null value.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_NODE_PROPERTY_VALUE

        public static final java.lang.String DEFAULT_NODE_PROPERTY_VALUE
        Attribute name to hold default property value in descriptor.
        See Also:
        Constant Field Values
      • DEFAULT_NODE_PROPERTY_VALUE_NULL

        public static final java.lang.Object DEFAULT_NODE_PROPERTY_VALUE_NULL
        Special value to mark properties where default value is null.
      • NULL_VALUE_TEXT

        public static final java.lang.String NULL_VALUE_TEXT
        Attribute name for expression that is displayed instead of null by the property editor.
        See Also:
        Constant Field Values
    • Method Detail

      • findBeanInfo

        public static java.beans.BeanInfo findBeanInfo​(java.lang.Object bean)
                                                throws java.beans.IntrospectionException
        Use this method when finding bean info for any bean. This method is finding the BeanInfo class and loads it using the same classloader as the bean's class was loaded with. If this way of finding BeanInfo fails it delegates to Introspector.getBeanInfo(java.lang.Class).

        When using Introspector.getBeanInfo(java.lang.Class) directly it produces SimpleBeanInfo instance probably just as a wrapper for original bean info class. This caused the properties were sorted and didn't respect the original order.

        Parameters:
        bean - The bean class to be analyzed.
        Returns:
        A BeanInfo object describing the target bean.
        Throws:
        java.beans.IntrospectionException
      • findCustomizer

        public static java.beans.Customizer findCustomizer​(java.lang.Object bean)
      • findCustomizerClass

        public static java.lang.Class<? extends java.beans.Customizer> findCustomizerClass​(java.lang.Class clazz)
        Finds customizer for class.
        Parameters:
        clazz - The class.
        Returns:
        Customizer or null.
        Since:
        16.2.8
      • findUICustomizer

        public static javax.swing.JComponent findUICustomizer​(java.lang.Object bean)
      • findUICustomizer

        public static javax.swing.JComponent findUICustomizer​(java.lang.Object bean,
                                                              boolean setObject)
      • hasUICustomizer

        public static boolean hasUICustomizer​(java.lang.Object bean)
      • computeProperties

        public static org.openide.nodes.BeanNode.Descriptor computeProperties​(java.lang.Object bean,
                                                                              java.beans.BeanInfo info)
        Extension to a descriptor computation to support properties that can be reverted to default value. Return the same set of properties as BeanNode.computeProperties(java.lang.Object, java.beans.BeanInfo) except for properties that provide default value from PropertyDescriptor#getValue(DEFAULT_NODE_PROPERTY_VALUE).
      • propertyEditorWithNullValue

        public static java.beans.PropertyEditor propertyEditorWithNullValue​(java.beans.PropertyEditor delegate,
                                                                            java.lang.String nullValue)
        Creates delegating property editor that displays passed string as a representation of null value. In addition to this it is not paintable for null value.
      • openPropertySheetForNode

        public static boolean openPropertySheetForNode​(org.openide.nodes.Node... nodes)
        Open the dialog with property sheet.
        Parameters:
        nodes - Customized node
        Returns:
        The status of the operation. true means data were potentially changed, false means node properties were not changed.