Salesforce @AuraEnabledアノテーションのサンプル

環境
Salesfoce

概要
@AuraEnabled アノテーションにより、クライアント側およびサーバー側から
Apex コントローラーメソッドへのアクセスが可能になります。こ
このアノテーションを指定することで、メソッドを Lightning コンポーネント
(Lightning Web コンポーネントと Aura コンポーネントの両方) で使用できるようになります。

関数
@AuraEnabled(continuation=true)
継続を返す Apex コントローラ メソッドには、
の注釈を付ける必要があります@AuraEnabled(continuation=true)。

@AuraEnabled(continuation=true cacheable=true)
継続アクションの結果をキャッシュするには、
cacheable=trueApex コールバック メソッドのアノテーションを設定します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Actionメソッド
@AuraEnabled(continuation=true cacheable=true)
public static Object startRequest() { }
// Callbackメソッド
@AuraEnabled(cacheable=true)
public static Object processResponse(List<String> labels,
Object state) { }
// Actionメソッド @AuraEnabled(continuation=true cacheable=true) public static Object startRequest() { } // Callbackメソッド @AuraEnabled(cacheable=true) public static Object processResponse(List<String> labels, Object state) { }
// Actionメソッド
@AuraEnabled(continuation=true cacheable=true)
public static Object startRequest() { }

// Callbackメソッド
@AuraEnabled(cacheable=true)
public static Object processResponse(List<String> labels,
  Object state) { }

 

IT

Posted by arkgame