]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/JavaReferenceValidator.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / types / JavaReferenceValidator.java
1 package org.simantics.scl.compiler.internal.codegen.types;\r
2 \r
3 import org.cojen.classfile.TypeDesc;\r
4 import org.simantics.scl.compiler.constants.generic.ClassRef;\r
5 \r
6 @SuppressWarnings("hiding")\r
7 public interface JavaReferenceValidator<Class,Method,Field,Constructor> {\r
8 \r
9     /**\r
10      * Tries to find the given class or returns null if the class\r
11      * does not exist.\r
12      */\r
13     Class findClass(TypeDesc name);\r
14     \r
15     boolean isInterface(Class clazz);\r
16     \r
17     boolean isPublic(Class clazz);\r
18     \r
19     /**\r
20      * Finds all methods that are compatible with type\r
21      * <pre>types[0] -> types[1] -> ... -> types[types.length-1]</pre> \r
22      */\r
23     Method[] findCompatibleMethods(Class clazz, boolean isStatic, String name, \r
24             TypeDesc[] parameterTypes, TypeDesc returnType);\r
25     TypeDesc getReturnType(Method method);    \r
26     TypeDesc[] getParameterTypes(Method method);\r
27 \r
28     Constructor[] findCompatibleConstructors(Class clazz, TypeDesc[] types);\r
29     TypeDesc[] getConstructorParameterTypes(Constructor constructor);\r
30     \r
31     Field findField(Class clazz, String name);\r
32     boolean isStaticField(Field field);\r
33     TypeDesc getFieldType(Field field);\r
34     boolean isAssignableFrom(TypeDesc to, TypeDesc from);\r
35 \r
36     Method[] chooseBest(Method[] methods);\r
37     \r
38     /**\r
39      * Returns a class ref object to the class or null if the\r
40      * class is not found.\r
41      */\r
42     ClassRef getClassRef(String className);\r
43 }\r