public enum CombineSelf extends Enum<CombineSelf>
| Enum Constant and Description |
|---|
DEFAULTS
Behaves exactly like
MERGE if paired element exists in any subsequent dominant document. |
MERGE
Merge elements.
|
OVERRIDABLE
Override element.
|
OVERRIDABLE_BY_TAG
Override element.
|
OVERRIDE
Override element.
|
REMOVE
Remove entire element with attributes and children.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ATTRIBUTE_NAME |
| Modifier and Type | Method and Description |
|---|---|
static CombineSelf |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CombineSelf[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CombineSelf MERGE
Attributes from dominant element override those from recessive element.
Child elements are by default paired using their keys (tag name and selected attributes) and combined
recursively. The exact behavior depends on 'combine.children' attribute value.
Example:
First:
<config>
<service id="1">
<parameter>parameter</parameter>
</service>
</config>
Second:
<config>
<service id="1">
<parameter2>parameter</parameter2>
</service>
</config>
Result:
<config>
<service id="1">
<parameter>parameter</parameter>
<parameter2>parameter</parameter2>
</service>
</config>
public static final CombineSelf REMOVE
Example:
First:
<config>
<service id="1">
<parameter>parameter</parameter>
</service>
</config>
Second:
<config>
<service id="1" combine.self="REMOVE"/>
</config>
Result:
<config>
</config>
public static final CombineSelf DEFAULTS
MERGE if paired element exists in any subsequent dominant document.
If paired element is not found in any dominant document behaves the same as REMOVE
This behavior is specifically designed to allow specifying default values which are used only when given element exists in any subsequent document.
Example:
First:
<config>
<service id="1" combine.self="DEFAULTS">
<parameter>parameter</parameter>
</service>
<service id="2" combine.self="DEFAULTS"/>
</config>
Second:
<config>
<service id="1">
</service>
</config>
Result:
<config>
<service id="1">
<parameter>parameter</parameter>
</service>
</config>
public static final CombineSelf OVERRIDE
Completely ignores content from recessive document by overwriting it with element from dominant document.
Example:
First:
<config>
<service id="1">
<parameter>parameter</parameter>
</service>
</config>
Second:
<config>
<service id="1" combine.self="override">
<parameter2>parameter2</parameter2>
</service>
</config>
Result:
<config>
<service id="1">
<parameter2>parameter2</parameter2>
</service>
</config>
public static final CombineSelf OVERRIDABLE
Completely ignores content from recessive document by overwriting it with element from dominant document.
The difference with OVERRIDE is that OVERRIDABLE is specified on the tag in recessive document.
Example:
First:
<config>
<service id="id1" combine.self="OVERRIDABLE">
<test/>
</service>
</config>
Second:
<config>
</config>
Result:
<config>
<service id="id1" combine.self="OVERRIDABLE">
<test/>
</service>
</config>
Example2:
First:
<config>
<service id="id1" combine.self="OVERRIDABLE">
<test/>
</service>
</config>
Second:
<config>
<service id="id1"/>
</config>
Result:
<config>
<service id="id1"/>
</config>
public static final CombineSelf OVERRIDABLE_BY_TAG
Completely ignores content from recessive document by overwriting it with element from dominant document.
The difference with OVERRIDABLE is that with OVERRIDABLE_BY_TAG recessive element is ignored
even when the id is different.
Example:
First:
<config>
<service id="id1" combine.self="OVERRIDABLE_BY_TAG">
<test/>
</service>
</config>
Second:
<config>
<service id="id2"/>
</config>
Result:
<config>
<service id="id2"/>
</config>
public static final String ATTRIBUTE_NAME
public static CombineSelf[] values()
for (CombineSelf c : CombineSelf.values()) System.out.println(c);
public static CombineSelf valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2021 Atteo. All rights reserved.