---
schema_version: "1"
id: 14162b2dc194cc84a2d6ecfd2c7bc67746b1c5bf92c12691f4a933c5e3bd0ec1
title: Flex Gateway ポリシーでの DataWeave のサポート
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/gateway/1.10/policies-flex-dataweave-support.md
canonical_url: https://docs.mulesoft.com/jp/gateway/1.10/policies-flex-dataweave-support
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 36dc69a1c226071eb0b63a0352a07efb70be6f1428a024dad2cfa4176dc1bf3e
description: MuleSoft Documentation Site
release: "1.10"
latest: false
---
# Flex Gateway ポリシーでの DataWeave のサポート

[DataWeave](https://docs.mulesoft.com/dataweave/latest/)​ は、MuleSoft がデータ変換用に設計したプログラミング言語です。DataWeave を使用すると、ある形式のデータを読み込んで解析し、データを変換して、異なる形式で書き出すという、よくあるインテグレーション開発者のユースケース向けのシンプルなソリューションを構築できます。

Flex Gateway は、ポリシー設定において DataWeave 式の一部をサポートします。DataWeave は内部ポリシーと PDK を使用して作成されたカスタムポリシーでのみサポートされています。

## [](#使用できる型)使用できる型

- [`Null`](https://docs.mulesoft.com/dataweave/latest/dataweave-type-system#null)
- `Boolean`
- `String`
- `Number`​ (64 ビット浮動小数点として処理)
- [`Array`](https://docs.mulesoft.com/dataweave/latest/dataweave-type-system#array-type)
- [`Object`](https://docs.mulesoft.com/dataweave/latest/dataweave-type-system#object-type)​ (反復キーは使用不可)

## [](#型で使用できる値コンストラクター)型で使用できる値コンストラクター

- [`Boolean`](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_boolean)
- [`String`](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_string)
- [`Number`](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_number)
- [`Array`](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_array)

## [](#型で使用できない値コンストラクター)型で使用できない値コンストラクター

- [`Null`](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_null)​ (​`null`​ リテラルの書き込みはサポートされない)
- [`Object`](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_object)​ (オブジェクトをリテラルとして定義することはできない)

## [](#使用できるフロー制御構造)使用できるフロー制御構造

- [`if else`](https://docs.mulesoft.com/dataweave/latest/dataweave-flow-control#control_flow_if_else)

## [](#使用できないフロー制御構造)使用できないフロー制御構造

- [`do`](https://docs.mulesoft.com/dataweave/latest/dataweave-flow-control#control_flow_do)

## [](#使用できるセレクター)使用できるセレクター

- `Array[Number]`
- `Array[String]`
- `Object[String]`
- `String[Number]`

## [](#使用できないセレクター)使用できないセレクター

- `Object[Number]`

## [](#使用できる等価演算子と比較演算子)使用できる等価演算子と比較演算子

- [`==`](https://docs.mulesoft.com/dataweave/latest/dw-operators#equality-and-relational-operators)
- [`!=`](https://docs.mulesoft.com/dataweave/latest/dw-operators#equality-and-relational-operators)
- [`>=`](https://docs.mulesoft.com/dataweave/latest/dw-operators#equality-and-relational-operators)
- [`<=`](https://docs.mulesoft.com/dataweave/latest/dw-operators#equality-and-relational-operators)

## [](#使用できる論理演算子)使用できる論理演算子

- [`not`](https://docs.mulesoft.com/dataweave/latest/dw-operators#logical_operators)
- [`and`](https://docs.mulesoft.com/dataweave/latest/dw-operators#logical_operators)
- [`or`](https://docs.mulesoft.com/dataweave/latest/dw-operators#logical_operators)

## [](#available-default-operators)使用できるデフォルト演算子

- [`default`](https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-defaults#example-of-using-the-keyword-default-to-set-a-default-value)

## [](#使用できる関数)使用できる関数

### [](#)`++`

- [`++(Array<S>, Array<T>): Array<S | T>`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-plusplus#plusplus1)
- [`++(String, String): String`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-plusplus#plusplus2)

### [](#contains)`contains`

- [`contains(Array<T>, Any): Boolean`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-contains#contains1)
- [`contains(String, String): Boolean`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-contains#contains2)

### [](#lower)`lower`

- [`lower(String): String`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-lower#lower1)
- [`lower(Null): Null`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-lower#lower2)

### [](#splitby)`splitBy`

- [`splitBy(String, String): Array<String>`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-splitby#splitby2)

### [](#sizeof)`sizeOf`

- [`sizeOf(Array<Any>): Number`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-sizeof#sizeof1)
- [`sizeOf(Object): Number`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-sizeof#sizeof2)
- [`sizeOf(String): Number`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-sizeof#sizeof4)

### [](#trim)`trim`

- [`trim(String): String`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-trim#trim1)
- [`trim(Null): Null`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-trim#trim2)

### [](#upper)`upper`

- [`upper(String): String`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-upper#upper1)
- [`upper(Null): Null`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-upper#upper2)

### [](#uuid)`uuid`

- [`uuid(): String`](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-uuid#uuid1)

### [](#dwcorestringssubstringafter)`dw::core::Strings::substringAfter`

- [`substringAfter(String, String): String`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringafter#substringafter1)
- [`substringAfter(Null, String): Null`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringafter#substringafter2)

### [](#dwcorestringssubstringafterlast)`dw::core::Strings::substringAfterLast`

- [`substringAfterLast(String, String): String`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringafterlast#substringafterlast1)
- [`substringAfterLast(Null, String): Null`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringafterlast#substringafterlast2)

### [](#dwcorestringssubstringbefore)`dw::core::Strings::substringBefore`

- [`substringBefore(String, String): String`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringbefore#substringbefore1)
- [`substringBefore(Null, String): Null`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringbefore#substringbefore2)

### [](#dwcorestringssubstringbeforelast)`dw::core::Strings::substringBeforeLast`

- [`substringBeforeLast(text: String, separator: String): String`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringbeforelast#substringbeforelast1)
- [`substringBeforeLast(text: Null, separator: String): Null`](https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringbeforelast#substringbeforelast2)

### [](#tobase64)toBase64

- [`toBase64(content: Binary): String`](https://docs.mulesoft.com/dataweave/latest/dw-binaries-functions-tobase64#tobase641)

### [](#frombase64)fromBase64

- [`fromBase64(base64String: String): Binary`](https://docs.mulesoft.com/dataweave/latest/dw-binaries-functions-frombase64#frombase641)

<table>
<tbody><tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Flex Gateway では、バイナリ型の結果を伴う DataWeave 式はサポートされません。​<code>dw::Binaries::fromBase64('dXNlcjpwYXNz')</code>​ 関数を使用するには、結果を文字列に変換してください。​<code>dw::util::Coercions::toString(binary: Binary, encoding: String): String</code>​ 関数を使用してバイナリ出力を文字列に変換します。たとえば、​<code><mark>[dw::util::Coercions::toString(dw::core::Binaries::fromBase64('dXNlcjpwYXNz'), 'UTF-8')]</mark></code>​ となります。
デフォルトで ​<code>[splitBy(dw::core::Binaries::fromBase64('dXNlcjpwYXNz'), ':')]</code>​ などのバイナリを変換する別の関数を使用している場合は、バイナリの手動変換をスキップできます。</p>
</div>
</td>
</tr>
</tbody></table>

### [](#tobinary)toBinary

- [`toBinary(str: String, encoding: String): Binary`](https://docs.mulesoft.com/dataweave/latest/dw-coercions-functions-tobinary#tobinary1)

### [](#tostring)toString

- [`toString(binary: Binary, encoding: String): String`](https://docs.mulesoft.com/dataweave/latest/dw-coercions-functions-tostring#tostring3)

## [](#available-predefined-variables)使用できる定義済み変数

- [`attributes`](https://docs.mulesoft.com/dataweave/latest/dataweave-variables-context)
    
    - `attributes.headers`
    - `attributes.method`​ (要求コンテキストでのみ使用可能)
    - `attributes.queryParams`​ (要求コンテキストでのみ使用可能)
    - `attributes.queryString`​ (要求コンテキストでのみ使用可能)
    - `attributes.requestPath`​ (要求コンテキストでのみ使用可能)
    - `attributes.requestUri`​ (要求コンテキストでのみ使用可能)
    - `attributes.localAddress`​ (要求コンテキストでのみ使用可能)
    - `attributes.remoteAddress`​ (要求コンテキストでのみ使用可能)
    - `attributes.scheme`​ (要求コンテキストでのみ使用可能)
    - `attributes.version`​ (要求コンテキストでのみ使用可能)
    - `attributes.statusCode`​ (応答コンテキストでのみ使用可能)
- [`authentication`](https://docs.mulesoft.com/dataweave/latest/dataweave-variables-context)
    
    - `authentication.clientId`
    - `authentication.clientName`
    - `authentication.principal`
    - `authentication.properties`
- `payload`
    
    - 項目は現在のペイロードに応じて異なります。たとえば、​`#[payload]`​ はメッセージの本文を返します。
- [`vars`](https://docs.mulesoft.com/dataweave/latest/dataweave-variables-context)
    
    - 個々のポリシーでサポートされる変数のセットは異なります。詳細は、[policies-includeed-directory.adoc](#policies-includeed-directory.adoc)にリストされたポリシーを参照してください。