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.
|
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 tag name and 'id' attribute 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 similar to 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 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 © 2014 Atteo. All rights reserved.