]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - 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
diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/JavaReferenceValidator.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/JavaReferenceValidator.java
new file mode 100644 (file)
index 0000000..21f775e
--- /dev/null
@@ -0,0 +1,43 @@
+package org.simantics.scl.compiler.internal.codegen.types;\r
+\r
+import org.cojen.classfile.TypeDesc;\r
+import org.simantics.scl.compiler.constants.generic.ClassRef;\r
+\r
+@SuppressWarnings("hiding")\r
+public interface JavaReferenceValidator<Class,Method,Field,Constructor> {\r
+\r
+    /**\r
+     * Tries to find the given class or returns null if the class\r
+     * does not exist.\r
+     */\r
+    Class findClass(TypeDesc name);\r
+    \r
+    boolean isInterface(Class clazz);\r
+    \r
+    boolean isPublic(Class clazz);\r
+    \r
+    /**\r
+     * Finds all methods that are compatible with type\r
+     * <pre>types[0] -> types[1] -> ... -> types[types.length-1]</pre> \r
+     */\r
+    Method[] findCompatibleMethods(Class clazz, boolean isStatic, String name, \r
+            TypeDesc[] parameterTypes, TypeDesc returnType);\r
+    TypeDesc getReturnType(Method method);    \r
+    TypeDesc[] getParameterTypes(Method method);\r
+\r
+    Constructor[] findCompatibleConstructors(Class clazz, TypeDesc[] types);\r
+    TypeDesc[] getConstructorParameterTypes(Constructor constructor);\r
+    \r
+    Field findField(Class clazz, String name);\r
+    boolean isStaticField(Field field);\r
+    TypeDesc getFieldType(Field field);\r
+    boolean isAssignableFrom(TypeDesc to, TypeDesc from);\r
+\r
+    Method[] chooseBest(Method[] methods);\r
+    \r
+    /**\r
+     * Returns a class ref object to the class or null if the\r
+     * class is not found.\r
+     */\r
+    ClassRef getClassRef(String className);\r
+}\r