/** * Returns a converter that first applies {@code other} then this converter. * * @param other The other converter. * @return A converter that first applies {@code other} then this converter. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default AttributeNameConverter compose(AttributeNameConverter other) { Checks.isNotNull(other, "other"); return (Element element, String name) -> convertAttributeName(element, other.convertAttributeName(element, name)); }
/** * Returns a converter that first applies this converter and then {@code other}. * * @param other The other converter. * @return A converter that first applies this converter and then {@code other}. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default AttributeNameConverter andThen(AttributeNameConverter other) { Checks.isNotNull(other, "other"); return (Element element, String name) -> other.convertAttributeName(element, convertAttributeName(element, name)); }
private final String convertAttributeName(Element element, String name) { return shareAttributeName(attributeNameConverter.convertAttributeName(element, name)); }
element.addAttribute(new Attribute(converter.convertAttributeName(element, att.getName()), att.getValue()));