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

com.alphasystem.docx4j.builder.wml.DocDefaultsBuilder Maven / Gradle / Ivy

There is a newer version: 0.5.5
Show newest version

package com.alphasystem.docx4j.builder.wml;

import org.docx4j.wml.DocDefaults;
import org.docx4j.wml.PPr;
import org.docx4j.wml.RPr;


/**
 * Fluent API builder for org.docx4j.wml.DocDefaults.
 * 
 */
public class DocDefaultsBuilder
    extends com.alphasystem.docx4j.builder.OpenXmlBuilder
{

    private DocDefaultsBuilder.RPrDefaultBuilder rPrDefaultBuilder;
    private DocDefaultsBuilder.PPrDefaultBuilder pPrDefaultBuilder;

    /**
     * Initialize the underlying object.
     * 
     */
    public DocDefaultsBuilder() {
        this(null);
    }

    /**
     * Initialize the builder with given object.
     * 
     * @param object
     *     the given object
     */
    public DocDefaultsBuilder(DocDefaults object) {
        super(object);
        rPrDefaultBuilder = new DocDefaultsBuilder.RPrDefaultBuilder(this.object.getRPrDefault());
        pPrDefaultBuilder = new DocDefaultsBuilder.PPrDefaultBuilder(this.object.getPPrDefault());
    }

    /**
     * Copies values fom src into target. Values of target will be overridden by the values from src.
     * 
     * @param src
     *     source object
     * @param target
     *     target object
     */
    public DocDefaultsBuilder(DocDefaults src, DocDefaults target) {
        this(target);
        if (src!= null) {
            DocDefaults.RPrDefault rPrDefault = src.getRPrDefault();
            if (rPrDefault!= null) {
                rPrDefault = new DocDefaultsBuilder.RPrDefaultBuilder(rPrDefault, object.getRPrDefault()).getObject();
            }
            DocDefaults.PPrDefault pPrDefault = src.getPPrDefault();
            if (pPrDefault!= null) {
                pPrDefault = new DocDefaultsBuilder.PPrDefaultBuilder(pPrDefault, object.getPPrDefault()).getObject();
            }
            withRPrDefault(rPrDefault).withPPrDefault(pPrDefault);
        }
    }

    protected DocDefaults createObject() {
        return WmlBuilderFactory.OBJECT_FACTORY.createDocDefaults();
    }

    public DocDefaultsBuilder withRPrDefault(DocDefaults.RPrDefault value) {
        if (value!= null) {
            object.setRPrDefault(value);
        }
        return this;
    }

    public DocDefaultsBuilder withRPrDefault(RPr rPr) {
        boolean initialized = (rPr!= null);
        if (initialized) {
            withRPrDefault(rPrDefaultBuilder.withRPr(rPr).getObject());
        }
        return this;
    }

    public DocDefaultsBuilder.RPrDefaultBuilder getRPrDefaultBuilder() {
        return rPrDefaultBuilder;
    }

    public DocDefaultsBuilder withPPrDefault(DocDefaults.PPrDefault value) {
        if (value!= null) {
            object.setPPrDefault(value);
        }
        return this;
    }

    public DocDefaultsBuilder withPPrDefault(PPr pPr) {
        boolean initialized = (pPr!= null);
        if (initialized) {
            withPPrDefault(pPrDefaultBuilder.withPPr(pPr).getObject());
        }
        return this;
    }

    public DocDefaultsBuilder.PPrDefaultBuilder getPPrDefaultBuilder() {
        return pPrDefaultBuilder;
    }


    /**
     * Fluent API builder for org.docx4j.wml.DocDefaults$PPrDefault.
     * 
     */
    public static class PPrDefaultBuilder
        extends com.alphasystem.docx4j.builder.OpenXmlBuilder
    {


        /**
         * Initialize the underlying object.
         * 
         */
        public PPrDefaultBuilder() {
            this(null);
        }

        /**
         * Initialize the builder with given object.
         * 
         * @param object
         *     the given object
         */
        public PPrDefaultBuilder(DocDefaults.PPrDefault object) {
            super(object);
        }

        /**
         * Copies values fom src into target. Values of target will be overridden by the values from src.
         * 
         * @param src
         *     source object
         * @param target
         *     target object
         */
        public PPrDefaultBuilder(DocDefaults.PPrDefault src, DocDefaults.PPrDefault target) {
            this(target);
            if (src!= null) {
                PPr pPr = src.getPPr();
                if (pPr!= null) {
                    pPr = new PPrBuilder(pPr, object.getPPr()).getObject();
                }
                withPPr(pPr);
            }
        }

        protected DocDefaults.PPrDefault createObject() {
            return WmlBuilderFactory.OBJECT_FACTORY.createDocDefaultsPPrDefault();
        }

        public DocDefaultsBuilder.PPrDefaultBuilder withPPr(PPr value) {
            if (value!= null) {
                object.setPPr(value);
            }
            return this;
        }

    }


    /**
     * Fluent API builder for org.docx4j.wml.DocDefaults$RPrDefault.
     * 
     */
    public static class RPrDefaultBuilder
        extends com.alphasystem.docx4j.builder.OpenXmlBuilder
    {


        /**
         * Initialize the underlying object.
         * 
         */
        public RPrDefaultBuilder() {
            this(null);
        }

        /**
         * Initialize the builder with given object.
         * 
         * @param object
         *     the given object
         */
        public RPrDefaultBuilder(DocDefaults.RPrDefault object) {
            super(object);
        }

        /**
         * Copies values fom src into target. Values of target will be overridden by the values from src.
         * 
         * @param src
         *     source object
         * @param target
         *     target object
         */
        public RPrDefaultBuilder(DocDefaults.RPrDefault src, DocDefaults.RPrDefault target) {
            this(target);
            if (src!= null) {
                RPr rPr = src.getRPr();
                if (rPr!= null) {
                    rPr = new RPrBuilder(rPr, object.getRPr()).getObject();
                }
                withRPr(rPr);
            }
        }

        protected DocDefaults.RPrDefault createObject() {
            return WmlBuilderFactory.OBJECT_FACTORY.createDocDefaultsRPrDefault();
        }

        public DocDefaultsBuilder.RPrDefaultBuilder withRPr(RPr value) {
            if (value!= null) {
                object.setRPr(value);
            }
            return this;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy