Class FragmentSerializer

  • All Implemented Interfaces:
    org.smooks.api.delivery.ContentHandler, org.smooks.api.delivery.ordering.Producer, org.smooks.api.lifecycle.PostFragmentLifecycle, org.smooks.api.resource.visitor.sax.ng.AfterVisitor, org.smooks.api.resource.visitor.sax.ng.BeforeVisitor, org.smooks.api.resource.visitor.sax.ng.SaxNgVisitor, org.smooks.api.resource.visitor.Visitor

    public class FragmentSerializer
    extends Object
    implements org.smooks.api.resource.visitor.sax.ng.BeforeVisitor, org.smooks.api.resource.visitor.sax.ng.AfterVisitor, org.smooks.api.delivery.ordering.Producer, org.smooks.api.lifecycle.PostFragmentLifecycle
    Basic message fragment serializer.
    Author:
    tom.fennelly@jboss.com
    • Constructor Detail

      • FragmentSerializer

        public FragmentSerializer()
    • Method Detail

      • setBindTo

        @Inject
        public FragmentSerializer setBindTo​(String bindTo)
        Set the bind-to beanId for the serialized fragment.
        Parameters:
        bindTo - The bind-to beanId for the serialized fragment.
        Returns:
        this instance.
      • setOmitXMLDeclaration

        @Inject
        public FragmentSerializer setOmitXMLDeclaration​(Optional<Boolean> omitXMLDeclaration)
        Omit the XML Declaration from the serialized fragments.
        Parameters:
        omitXMLDeclaration - True if the XML declaration is to be omitted, otherwise false.
        Returns:
        this instance.
      • setChildContentOnly

        @Inject
        public FragmentSerializer setChildContentOnly​(Optional<Boolean> childContentOnly)
        Set whether or not the child content only should be serialized.

        This variable is, by default, false.

        Parameters:
        childContentOnly - True if the child content only (exclude the targeted element itself), otherwise false.
        Returns:
        this instance.
      • setRetain

        @Inject
        public FragmentSerializer setRetain​(Optional<Boolean> retain)
        Retain the fragment bean in the BeanContext after it's creating fragment has been processed.
        Parameters:
        retain - True if the fragment bean is to be retained in the BeanContext, otherwise false.
        Returns:
        this instance.
      • getProducts

        public Set<? extends Object> getProducts()
        Specified by:
        getProducts in interface org.smooks.api.delivery.ordering.Producer
      • visitBefore

        public void visitBefore​(Element element,
                                org.smooks.api.ExecutionContext executionContext)
                         throws org.smooks.api.SmooksException
        Specified by:
        visitBefore in interface org.smooks.api.resource.visitor.sax.ng.BeforeVisitor
        Throws:
        org.smooks.api.SmooksException
      • visitAfter

        public void visitAfter​(Element element,
                               org.smooks.api.ExecutionContext executionContext)
                        throws org.smooks.api.SmooksException
        Specified by:
        visitAfter in interface org.smooks.api.resource.visitor.sax.ng.AfterVisitor
        Throws:
        org.smooks.api.SmooksException
      • onPostFragment

        public void onPostFragment​(org.smooks.api.delivery.fragment.Fragment fragment,
                                   org.smooks.api.ExecutionContext executionContext)
        Specified by:
        onPostFragment in interface org.smooks.api.lifecycle.PostFragmentLifecycle