最終更新日 :
2024年1月19日
説明
Avro 文字列データ表現を、CFML 構造体や CFML 配列などの CFML データに変換します。
戻り値
ColdFusion 形式のデータ値:構造体、配列、クエリ、単純値
シンタックス
deserializeAVRO(data, readerSchema, strictMapping, useCustomSerialization)
deserializeAVRO(data, readerSchema, strictMapping, useCustomSerialization)
deserializeAVRO(data, readerSchema, strictMapping, useCustomSerialization)
パラメーター
パラメーター | 必須 | 説明 |
data | はい | ColdFusion データ値または ColdFusion データ値を表す変数です。 |
readerSchema | はい | テキスト文字列または絶対ファイルパスとして渡されるスキーマ。 |
strictMapping | いいえ | AVRO を厳密に変換するかどうかを指定するブール値です。
|
useCustomSerialization |
いいえ | true または false です。customSerializer を使用するかどうかを指定します。デフォルト値は true です。シリアル化には必ず、カスタムシリアライザーが使用されます。false の場合、Avro シリアル化は ColdFusion のデフォルト動作を使用して実行されます。 |
例
<cfscript>
// Avro スキーマを定義
mySchema= '{
“namespace”: “first.example”,
“type”: “record”,
“name”: “User”,
“fields”: [
{“name”: “name”, “type”: “string”},
{“name”: “favorite_number”, “type”: [“int”]},
{“name”: “favorite_color”, “type”: [“string”]}
]
}'
// 上記のスキーマに準拠するデータを設定
data= {
“name”:“Jack Sparrow”,
“favorite_number”:{“int”:9},
“favorite_color”:{“string”:“red”}
}
avroSerializeResponse = serializeAVRO(data, mySchema)
writedump(avroSerializeResponse)
avroDeSerializeResponse = deSerializeAVRO(avroSerializeResponse, mySchema, true, false)
writedump(avroDeSerializeResponse)
</cfscript>
<cfscript>
// Avro スキーマを定義
mySchema= '{
“namespace”: “first.example”,
“type”: “record”,
“name”: “User”,
“fields”: [
{“name”: “name”, “type”: “string”},
{“name”: “favorite_number”, “type”: [“int”]},
{“name”: “favorite_color”, “type”: [“string”]}
]
}'
// 上記のスキーマに準拠するデータを設定
data= {
“name”:“Jack Sparrow”,
“favorite_number”:{“int”:9},
“favorite_color”:{“string”:“red”}
}
avroSerializeResponse = serializeAVRO(data, mySchema)
writedump(avroSerializeResponse)
avroDeSerializeResponse = deSerializeAVRO(avroSerializeResponse, mySchema, true, false)
writedump(avroDeSerializeResponse)
</cfscript>
<cfscript> // Avro スキーマを定義 mySchema= '{ “namespace”: “first.example”, “type”: “record”, “name”: “User”, “fields”: [ {“name”: “name”, “type”: “string”}, {“name”: “favorite_number”, “type”: [“int”]}, {“name”: “favorite_color”, “type”: [“string”]} ] }' // 上記のスキーマに準拠するデータを設定 data= { “name”:“Jack Sparrow”, “favorite_number”:{“int”:9}, “favorite_color”:{“string”:“red”} } avroSerializeResponse = serializeAVRO(data, mySchema) writedump(avroSerializeResponse) avroDeSerializeResponse = deSerializeAVRO(avroSerializeResponse, mySchema, true, false) writedump(avroDeSerializeResponse) </cfscript>