// that takes a single string
for ( Method method : methodList ) {
Class<?>[] paramClasses = method.getParameterTypes();
if ( paramClasses.length != 1 ) {
// we don't know how to handle this
throw new GenericSignatureFormatError();
}
Class<?> paramclass = paramClasses[0];
if ( paramclass.equals( String.class ) ) {
done = true;
method.invoke( pojo, new Object[] { value } );
break;
}
}
if ( !done ) {
for ( Method method : methodList ) {
Class<?>[] paramClasses = method.getParameterTypes();
if ( paramClasses.length != 1 ) {
// we don't know how to handle this
throw new GenericSignatureFormatError();
}
Class<?> paramclass = paramClasses[0];
if ( paramclass.equals( Boolean.class ) || paramclass.equals( boolean.class ) ) {
done = true;
method.invoke( pojo, new Object[] { new Boolean( value ) } );
break;
} else if ( paramclass.equals( Integer.class ) || paramclass.equals( int.class ) ) {
done = true;
method.invoke( pojo, new Object[] { new Integer( value ) } );
break;
} else if ( paramclass.equals( Long.class ) || paramclass.equals( long.class ) ) {
done = true;
method.invoke( pojo, new Object[] { new Long( value ) } );
break;
} else if ( paramclass.equals( Double.class ) || paramclass.equals( double.class ) ) {
done = true;
method.invoke( pojo, new Object[] { new Double( value ) } );
break;
} else if ( paramclass.equals( Float.class ) || paramclass.equals( float.class ) ) {
done = true;
method.invoke( pojo, new Object[] { new Float( value ) } );
break;
} else if ( paramclass.equals( BigDecimal.class ) ) {
done = true;
method.invoke( pojo, new Object[] { new BigDecimal( value ) } );
break;
}
}
}
if ( !done ) {
throw new GenericSignatureFormatError();
}
}