この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

Newer Version Available

This content describes an older version of this product. View Latest

compileClasses()

Developer Edition または Sandbox を使用している組織の Apex をコンパイルします。

構文

1CompileClassResult[] = compileClasses(string[] classList);

使用方法

このコールを使用して、Developer Edition または Sandbox を使用している組織の Apex クラスをコンパイルします。本番組織では、compileAndTest() を使用する必要があります。

このコールは、DebuggingHeaderSessionHeader をサポートしています。API の SOAP ヘッダーの詳細は、SOAP API 開発者ガイドを参照してください。

サンプルコード —Java

1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void compileClassesSample() {
18    String p1 = "public class p1 {\n"
19      + "public static Integer var1 = 0;\n"
20      + "public static void methodA() {\n"
21      + " var1 = 1;\n" + "}\n"
22      + "public static void methodB() {\n"
23      + " p2.MethodA();\n" + "}\n"
24      + "}";
25    String p2 = "public class p2 {\n"
26      + "public static Integer var1 = 0;\n"
27      + "public static void methodA() {\n"
28      + " var1 = 1;\n" + "}\n"
29      + "public static void methodB() {\n"
30      + " p1.MethodA();\n" + "}\n"
31      + "}";
32    CompileClassResult[] r = new CompileClassResult[0];
33    try {
34        r = apexBinding.compileClasses(new String[]{p1, p2});
35    } catch (RemoteException e) {
36        System.out.println("An unexpected error occurred: "
37          + e.getMessage());
38    }
39    if (!r[0].isSuccess()) {
40        System.out.println("Couldn't compile class p1 because: "
41          + r[0].getProblem());
42    }
43    if (!r[1].isSuccess()) {
44        System.out.println("Couldn't compile class p2 because: "
45          + r[1].getProblem());
46    }
47}

引数

名前 説明
scripts string* Apex クラスおよびこの要求に設定する必要のある項目の値を含む要求。

* リンクから『SOAP API 開発者ガイド』にアクセスできます。