Main page / Java Connectivity page

OverloadMethods - Method Signatures overloaded in Java


Description: 
	In Java it is possible to overload method signatures. Because OMG's IDL does 
	not allow method overloading, the OMG Java-to-IDL mapping defines a simple 
	name mangling scheme for overloaded methods. 
	
	If a method is uniquely defined in a base interface its name will not be mangled 
	within the scope of that interface, but if the method is overloaded by a derived 
	method the name is enhanced within the scope of the derived interface by adding 
	the parameter type names to the original method name, i.e.
	
		void hello(int x) --> void hello__long(in long x)
	
	The following example shows how overloaded methods are mapped to .NET. 

	
Source: 
	MinCor\DemoJava\OverloadMethods

Mapping: 
	overloaded Java method   <--->  unique .Net method




Example 

The Java server:

    Interface     : OverloadMethods\Greetings.java
    Implementation: OverloadMethods\GreetingsImpl.java

    
    public interface Greetings extends Remote  {

        String hello( String Name) 
            throws RemoteException;

        String hello( String FirstName, String LastName) 
            throws RemoteException;

    }
    


The .Net client:

    Implementation: ClientImpl.cs
    IDL-File      : OverloadMethods.idl
    Generated     : OverloadMethods.cs
          

    Call the Server:
          
      
    // ...
    a_oFrmClt.writeLog(oGreetings.hello__CORBA_WStringValue( "Joe"));

    a_oFrmClt.writeLog(oGreetings.hello__CORBA_WStringValue__CORBA_WStringValue("Joe", "Foo"));
    // ...