Modifier and Type | Required Element and Description |
---|---|
Class<?>[] |
javaType |
String[] |
literal |
NativeType[] |
nativeType |
int[] |
optParamIndex |
int[] |
paramIndexMapping
Returns an array of indices, that maps the parameter of the java interface to the parameter index of the COM interface
Assume we have an COM interface with an function like |
Variant.Type[] |
variantType
A list of
Variant.Type s used to generate the default parameters. |
public abstract int[] paramIndexMapping
[helpstring("Test function")] HRESULT TestFunction([in] VARIANT notOptional, [in, optional, defaultvalue("forty-two")] VARIANT opt1, [in, defaultvalue(42)] VARIANT opt2, [in, lcid] long localeID, [out, retval] VARIANT *result);Then we can generate three Java interface methods:
Variant testFunction(Variant notOptional, Variant opt1, Variant opt2, int localeID); Variant testFunction(Variant notOptional, Variant opt1, int localeID); Variant testFunction(Variant notOptional, int localeID);The first function would not need a
UseDefaultValues
annotation at all. The second function needs an annotation with a parameter mapping [0, 1, 3]
and the third function needs the mapping [0, 3] [lcid]
parameter and that this parameter always needs to be at the
end of the optional parameters. But consider the case, where we have an list of optional parameters with default values and Com4j is not able to handle an
optional parameter in the middle of list. Using parameter index mapping makes it possible to generate Java interface methods anyway.
public abstract int[] optParamIndex
public abstract Class<?>[] javaType
public abstract NativeType[] nativeType
public abstract Variant.Type[] variantType
Variant.Type
s used to generate the default parameters. The entry in this list is only needed in the case that the corresponding
NativeType is of type NativeType.VARIANT
public abstract String[] literal
Copyright © 2014. All rights reserved.