All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.hiq.oss.spring.nats.config.xmlns.parser.NatsAvroBeanDefinitionParser Maven / Gradle / Ivy

package se.hiq.oss.spring.nats.config.xmlns.parser;

import java.util.Optional;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;

import org.w3c.dom.Element;
import static se.hiq.oss.spring.nats.config.NatsBeans.SER_DE_FACTORY;
import se.hiq.oss.spring.nats.message.serde.avro.AvroMessageSerDeFactory;

public class NatsAvroBeanDefinitionParser extends AbstractNatsBeanDefinitionParser {

    @Override
    protected Class getBeanClass(Element element) {
        return AvroMessageSerDeFactory.class;
    }

    @Override
    protected void doParse(Element element, ParserContext pc,
                           BeanDefinitionBuilder bean) {
        element.setAttribute(ID_ATTRIBUTE, SER_DE_FACTORY);
        element.setAttribute(NAME_ATTRIBUTE, SER_DE_FACTORY);
        Optional objectValidator = getAttributeValue(element, "object-validator");
        objectValidator.ifPresent(v -> bean.addPropertyReference("validator", v));
        createBeans(pc, element, SER_DE_FACTORY);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy