Skip to content

Commit 0b5f07a

Browse files
committed
Added description of "reuseCode" property.
1 parent 5f4554e commit 0b5f07a

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

appendix/fields.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ Applicable only to members of the <<messages-messages, &lt;message&gt; >> or <<f
3434
|**validOverride**|"any", "replace", "extend", "none"|4|no|any|Control the overriding code for **valid** retrieval.
3535
|**nameOverride**|"any", "replace", "extend", "none"|4|no|any|Control the overriding code for **name** retrieval.
3636
|**copyCodeFrom**|<<intro-references, reference>> string|5|no||Specify field, overriding or other extra code of which needs to be copied.
37+
|**reuseCode**|<<intro-boolean, bool>>|5|no|false|In case of **reuse** apply **copyCodeFrom** with the same <<intro-references, reference>> string.
3738
|===

fields/common.adoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,33 @@ It means that some portion of copied code can be cleared.
412412
</schema>
413413
----
414414

415+
In case of <<fields-common-reusing-other-fields, reusing>> other field definition, only the field
416+
definition properties are copied. The extra code that the original field might inject is **NOT** included
417+
in such copy by default. The copying of injected code must be specified explicitly using
418+
**copyCodeFrom** property descirbed above, or to avoid repetition of the
419+
<<intro-references, reference>> string, another **reuseCode** property with
420+
boolean value can be used in addition to **reuse** one.
421+
[source,xml]
422+
----
423+
<?xml version="1.0" encoding="UTF-8"?>
424+
<schema ...>
425+
<fields>
426+
<ns name="ns1">
427+
<bundle name="ComplexLength" valueOverride="replace" semanticType="length">
428+
<!-- Requires extra code for length value calculation to be injected -->
429+
...
430+
</bitfield>
431+
432+
<bitfield name="ComplexLength1" reuse="ns1.ComplexLength" copyCodeFrom="ns1.ComplexLength">
433+
<!-- Copies all the extra code injected to ComplexLength in addition to its properties -->
434+
</bitfield>
435+
436+
<bitfield name="ComplexLength2" reuse="ns1.ComplexLength" reuseCode="true">
437+
<!-- Equivalent to ComplexLength1 -->
438+
</bitfield>
439+
</ns>
440+
</fields>
441+
</schema>
442+
----
443+
415444
Use <<appendix-fields, properties table>> for future references.

0 commit comments

Comments
 (0)