functionReturnType

functionReturnType(t: Type): Type | Null

関数の戻り値のデータ型の型を返します。 入力種別が Function (関数) 型でない場合、この関数は失敗します。

DataWeave バージョン 2.3.0 で導入されました。

パラメーター

名前 説明

t

関数型。

次の例では、さまざまな入力での ​functionReturnType​ の動作を示します。

ソース

%dw 2.0
output application/json
import * from dw::core::Types
type AFunction = (String, Number) -> Number
type AFunction2 = () -> Number
---
{
    a: functionReturnType(AFunction),
    b: functionReturnType(AFunction2)
}

出力

{
  "a": "Number",
  "b": "Number"
}