照合変換の例
照合変換ガジェットはwidgets.xml
に追加され、EDQのプロセッサ(ウィジェット)とまったく同じ方法で記述されます。「記述されたプロセッサの例」を参照してください。
唯一の制限として、照合変換では、入力と出力の両方とも1つのみである必要があります。
例2-8 大文字変換用のスクリプトベースのガジェットの例
次は、大文字変換用のスクリプトベースのガジェットの例です。
The following is an example of a script-based gadget for an Upper Case transformation: <!-- ************************************************************ --> <!-- script for a simple uppercase transformation --> <!-- ************************************************************ --> <widget id="customUppercase" class="com.datanomic.director.match.library.util.JavaScriptGadget"> <guidata> <label>%custom.uppercase.gadget</label> <group>transformers</group> <icon>script</icon> </guidata> <!-- inputs --> <inputs> <input id="1" type="string"> <guidata><label>%customer.uppercase.input</label></guidata> </input> </inputs> <!-- outputs --> <outputs cardinality="1:1"> <output id="1" type="string" name="result"> <guidata><label>%customer.uppercase.output</label></guidata> </output> </outputs> <parameters> <parameter name="script"> <![CDATA[ function doit() { output1 = input1.toUpperCase(); } ]]> </parameter> <parameter name="function">doit</parameter> </parameters> </widget>