compileClasses()
Developer Edition または Sandbox を使用している組��の Apex をコンパイルします。
構文
1CompileClassResult[] = compileClasses(string[] classList);使用方法
このコールを使用して、Developer Edition または Sandbox を使用している組織の Apex クラスをコンパイルします。本番組織では、compileAndTest() を使用する必要があります。
このコールは、DebuggingHeader と SessionHeader をサポートしています。
サンプルコード — Java
1public void compileClassesSample() {
2 String p1 = "public class p1 {\n"
3 + "public static Integer var1 = 0;\n"
4 + "public static void methodA() {\n"
5 + " var1 = 1;\n" + "}\n"
6 + "public static void methodB() {\n"
7 + " p2.MethodA();\n" + "}\n"
8 + "}";
9 String p2 = "public class p2 {\n"
10 + "public static Integer var1 = 0;\n"
11 + "public static void methodA() {\n"
12 + " var1 = 1;\n" + "}\n"
13 + "public static void methodB() {\n"
14 + " p1.MethodA();\n" + "}\n"
15 + "}";
16 CompileClassResult[] r = new CompileClassResult[0];
17 try {
18 r = apexBinding.compileClasses(new String[]{p1, p2});
19 } catch (RemoteException e) {
20 System.out.println("An unexpected error occurred: "
21 + e.getMessage());
22 }
23 if (!r[0].isSuccess()) {
24 System.out.println("Couldn't compile class p1 because: "
25 + r[0].getProblem());
26 }
27 if (!r[1].isSuccess()) {
28 System.out.println("Couldn't compile class p2 because: "
29 + r[1].getProblem());
30 }
31}引数
| 名前 | 型 | 説明 |
|---|---|---|
| scripts | string | Apex クラスおよびこの要求に設定する必要のある項目の値を含む要求。 |