public static final boolean homeMethodEquals ( Method homeMethod , Properties beanMethodProps ) { if ( ( homeMethod == null ) || ( beanMethodProps == null ) ) { return false ; } //---------------------- // Compare method names //---------------------- String homeMethodName = homeMethod . getName ( ) ; String beanMethodName = ( String ) beanMethodProps . get ( "Name" ) ; if ( ! homeMethodName . equals ( beanMethodName ) ) { return false ; } //------------------------- // Compare parameter types //------------------------- Class < ? > homeMethodParamTypes [ ] = homeMethod . getParameterTypes ( ) ; String beanMethodParamTypes [ ] = ( String [ ] ) beanMethodProps . get ( "ArgumentTypes" ) ; if ( homeMethodParamTypes . length != beanMethodParamTypes . length ) { return false ; } for ( int i = 0 ; i < homeMethodParamTypes . length ; i ++ ) { if ( ! homeMethodParamTypes [ i ] . getName ( ) . equals ( beanMethodParamTypes [ i ] ) ) { return false ; } } //----------------------------------------------------------------- // If method names are equal and parameter types match then the // methods are equal for our purposes. Java does not allow methods // with the same name and parameter types that differ only in // return type and/or exception signature. //----------------------------------------------------------------- return true ; }
This utility method compares a method on the bean s home interface with a method on the bean and returns true iff they are equal for the purpose of determining if the control descriptor associated with the bean method applies to the remote interface method . Equality in this case means that the bean method has the same name as the home method and they have the same parameters .