IJavaClass::AddMethod

Use this method to add a method class member.

Syntax

HRESULT AddMethod([in] JavaMemberModifiers mods, [in] BSTR bstrSignature,
[in] BSTR bstrName, [in] BSTR bstrFormalNames,
[in] BSTR bstrBodyText, [in] long nIndex,
[out, retval] IJavaMethod** retval);

Function AddMethod(ByVal mods As Long, ByVal bstrSignature As String, ByVal bstrName As String, ByVal bstrFormalNames As String, ByVal bstrBodyText As String, ByVal nIndex As Long) As IJavaMethod

Parameters

mods

Modifiers for the new method.

bstrSignature

The type signature for the new method, including parameter types and the return type.

bstrName

The name of the new method.

bstrFormalNames

A comma-separated list of the formal parameter names for the new method.

bstrBodyText

The text to be inserted as the body of the new method. May be Null.

nIndex

The index of the existing member before which the new method should be inserted. To insert the new method at the end of the class, pass –1 as the index.

Remarks

To add a constructor to a class, call AddMethod with no return type specified in the signature and a name that is identical to the class name.