Java Utililty Methods XML Attribute Set

List of utility methods to do XML Attribute Set

Description

The list of methods to do XML Attribute Set are organized into topic(s).

Method

voidsetPropertyIfAttributePresent(BeanDefinitionBuilder builder, Element element, String attributeName)
set Property If Attribute Present
String attributeValue = element.getAttribute(attributeName);
if (StringUtils.hasText(attributeValue)) {
    builder.addPropertyValue(Conventions.attributeNameToPropertyName(attributeName),
            new TypedStringValue(attributeValue));
voidsetPropertyReference(BeanDefinitionBuilder builder, Element element, String attribute, String property)
Configures a bean property reference with the value of the attribute of the given name if it is configured.
Assert.notNull(builder, "BeanDefinitionBuilder must not be null!");
Assert.notNull(element, "Element must not be null!");
Assert.hasText(attribute, "Attribute name must not be null!");
Assert.hasText(property, "Property name must not be null!");
String value = element.getAttribute(attribute);
if (StringUtils.hasText(value)) {
    builder.addPropertyReference(property, value);