Debian Codegraph @

native/jpype_module/src/main/java/org/jpype/manager/ClassDescriptor.java

raw symbols SCIP
1 /* ****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 **************************************************************************** */
16 package org.jpype.manager;
17
18 import java.lang.reflect.Executable;
19 import java.lang.reflect.Method;
20
21 /**
22 * A list of resources associated with this class.
23 * <p>
24 * These can be accessed within JPype using the org.jpype.manager.TypeManager.
25 * <p>
26 */
27 public class ClassDescriptor
28 {
29
30 public Class<?> cls;
31 /**
32 * JPClass pointer for this class.
33 */
34 public long classPtr;
35 /**
36 * JPMethodDispatch for the constructor.
37 */
38 public long constructorDispatch;
39 public long[] constructors;
40 /**
41 * Resources needed by the class
42 */
43 public long[] methodDispatch;
44 public Executable[] methodIndex;
45 public long[] methods;
46 public int methodCounter = 0;
47 public long[] fields;
48 public long anonymous;
49 public int functional_interface_parameter_count;
50
51 ClassDescriptor(Class cls, long classPtr, Method method)
52 {
53 this.cls = cls;
54 this.classPtr = classPtr;
55 if (this.classPtr == 0)
56 throw new NullPointerException("Class pointer is null for " + cls);
57 if (method != null)
58 functional_interface_parameter_count = method.getParameterCount();
59 else
60 functional_interface_parameter_count = -1;
61 }
62
63 long getMethod(Method requestedMethod)
64 {
65 for (int i = 0; i < methods.length; ++i)
66 if (this.methodIndex[i].equals(requestedMethod))
67 return this.methods[i];
68 return 0;
69
70 }
71 }