/** * Fill a builder with attribute values from the provided {@code Conditions} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(Conditions instance) { Objects.requireNonNull(instance, "instance"); matchType(instance.getMatchType()); addAllConditions(instance.getConditions()); Optional<String> descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } return this; }
public static void writeXML(final Document document, final Element currentElement, final Conditions conditions) { final Element conditionsElement = document.createElement(XML_CONDITIONS_TAG_NAME); conditionsElement.setAttribute(XML_ATTR_MATCH_TYPE, String.valueOf(conditions.getMatchType().ordinal())); for(final Condition condition: conditions.getConditions()){ ConditionWriter.writeXML(document, conditionsElement, condition); } currentElement.appendChild(conditionsElement); } }
@Override public void writeXML(final Document document, final Element currentElement, final String outputFolder) { final Element ifElement = document.createElement(XML_TAG_NAME); super.writeXML(document, ifElement, outputFolder); currentElement.appendChild(ifElement); final IfThenElse ifThenElse = ((IfThenElse) this.element); ElementWriter.writeDescription(document, ifElement, ifThenElse.getConditions().getDescription()); ContainerForMultiWriter.of(ifThenElse.getThen()).writeXML(document, ifElement, outputFolder); ContainerForMultiWriter.of(ifThenElse.getElse()).writeXML(document, ifElement, outputFolder); ConditionsWriter.writeXML(document, ifElement, ifThenElse.getConditions()); } }