forked from kohsuke/com4j
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMethodIntrospector.java
More file actions
43 lines (36 loc) · 1.05 KB
/
MethodIntrospector.java
File metadata and controls
43 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com4j;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
/**
* Defines "toolkit" to introspect a COM-bound method.
*
* @author Kohsuke Kawaguchi
*/
class MethodIntrospector {
final Method method;
final Annotation[][] pa;
final Type[] paramTypes;
protected MethodIntrospector(Method method) {
this.method = method;
this.pa = method.getParameterAnnotations();
this.paramTypes = method.getGenericParameterTypes();
}
protected final MarshalAs getMarshalAs(int idx) {
for( Annotation a : pa[idx] )
if( a instanceof MarshalAs )
return (MarshalAs)a;
return null;
}
protected final NativeType getParamConversation(int idx) {
MarshalAs ma = getMarshalAs(idx);
if (ma != null) {
return ma.value();
} else {
return StandardComMethod.getDefaultConversion(paramTypes[idx]);
}
}
protected final int paramLength() {
return pa.length;
}
}