KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > beans > BeanInfo

java.beans
Interface BeanInfo

All Known Subinterfaces:
BeanContextServiceProviderBeanInfo
All Known Implementing Classes:
SimpleBeanInfo
See Also:
Top Examples, Source Code

BeanInfo[] getAdditionalBeanInfo()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


BeanDescriptor getBeanDescriptor()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getDefaultEventIndex()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getDefaultPropertyIndex()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


EventSetDescriptor[] getEventSetDescriptors()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Image getIcon(int iconKind)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


MethodDescriptor[] getMethodDescriptors()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


PropertyDescriptor[] getPropertyDescriptors()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1613]Copy Java Bean
By Anonymous on 2005/11/05 15:35:08  Rate
//Copy Java Bean 
 public static String transfer  ( Object source, Object target )  
  {   
   PropertyDescriptor [  ]  sourceProperties = null; 
   PropertyDescriptor [  ]  targetProperties = null; 
 try 
  {  
     sourceProperties = Introspector.getBeanInfo  ( source.getClass  (  )  )  
       .getPropertyDescriptors  (  ) ; 
     targetProperties = Introspector.getBeanInfo  ( target.getClass  (  )  )  
       .getPropertyDescriptors  (  ) ; 
  }  
 catch  ( IntrospectionException ex )  
  {  
     return  ( "Couldn't derive property descriptors." ) ; 
  }  
  
  
 StringBuffer results = new StringBuffer  (  ) ; 
 Object [  ]  value =  {  null  } ; 
  
  
 Source:  
 for  ( int s = 0; s  <  sourceProperties.length; ++s )  
  {  
     String name = sourceProperties [ s ] .getName  (  ) ; 
     try 
      {  
   Target:  
   for  ( int t = 0; t  <  targetProperties.length; ++t )  
       if  ( targetProperties [ t ] .getName  (  ) .equals  ( name )  )  
        {  
     Method read = sourceProperties [ s ] .getReadMethod  (  ) ; 
     Method write = targetProperties [ t ] .getWriteMethod  (  ) ; 
     if  ( read == null || write == null )  
         break Target; 
  
  
     value [ 0 ]  = read.invoke  ( source, null ) ; 
     write.invoke  ( target, value ) ; 
  
  
     results.append  ( "Transferred property " )  
            .append  ( name )  
            .append  ( " = " )  
            .append  ( value [ 0 ]  )  
            .append  ( "." )  
            .append  ( "\r\n" ) ; 
  
  
     break Target; 
        }  
      }  
     catch  ( Exception ex )  
      {  
   results.append  ( "Exception transferring property " )  
          .append  ( name )  
          .append  ( ": " )  
          .append  ( ex.getClass  (  ) .getName  (  )  )  
          .append  ( "\r\n" ) ; 
      }  
  }  
  
  
   return results.toString  (  ) ; 
  
  
  } 


static final int ICON_COLOR_16x16
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


static final int ICON_COLOR_32x32
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


static final int ICON_MONO_16x16
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


static final int ICON_MONO_32x32
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags