java.lang.Object
java.beans.Introspector
- See Also:
- Top Examples, Source Code,
Introspector.flushFromCaches
, Introspector.flushCaches
public static String decapitalize(String name)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static void flushCaches()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static void flushFromCaches(Class<?> clz)
- See Also:
- NullPointerException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static BeanInfo getBeanInfo(Class<?> beanClass)
throws IntrospectionException
- See Also:
flushFromCaches(java.lang.Class>)
, flushCaches()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1612]Copy Java Bean
By Anonymous on 2005/11/04 20:23: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 ( ) ;
}
public static BeanInfo getBeanInfo(Class<?> beanClass,
int flags)
throws IntrospectionException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static BeanInfo getBeanInfo(Class<?> beanClass,
Class<?> stopClass)
throws IntrospectionException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static String[] getBeanInfoSearchPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final int IGNORE_ALL_BEANINFO
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final int IGNORE_IMMEDIATE_BEANINFO
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static void setBeanInfoSearchPath(String[] path)
- See Also:
SecurityManager.checkPropertiesAccess()
, SecurityException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final int USE_ALL_BEANINFO
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples