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

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

There is a newer version: 0.5.5
Show newest version

package com.alphasystem.docx4j.builder.wml;

import java.math.BigInteger;
import java.util.List;
import javax.xml.datatype.XMLGregorianCalendar;
import org.docx4j.wml.CTRPrChange;


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

    private CTRPrChangeBuilder.RPrBuilder rPrBuilder;

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

    /**
     * Initialize the builder with given object.
     * 
     * @param object
     *     the given object
     */
    public CTRPrChangeBuilder(CTRPrChange object) {
        super(object);
        rPrBuilder = new CTRPrChangeBuilder.RPrBuilder(this.object.getRPr());
    }

    /**
     * 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 CTRPrChangeBuilder(CTRPrChange src, CTRPrChange target) {
        this(target);
        if (src!= null) {
            CTRPrChange.RPr rPr = src.getRPr();
            if (rPr!= null) {
                rPr = new CTRPrChangeBuilder.RPrBuilder(rPr, object.getRPr()).getObject();
            }
            withRPr(rPr).withAuthor(src.getAuthor()).withDate(src.getDate()).withId(WmlBuilderFactory.cloneBigInteger(src.getId()));
        }
    }

    protected CTRPrChange createObject() {
        return WmlBuilderFactory.OBJECT_FACTORY.createCTRPrChange();
    }

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

    public CTRPrChangeBuilder withRPr(Object... egrPrBase) {
        boolean initialized = hasContent(egrPrBase);
        if (initialized) {
            withRPr(rPrBuilder.addEGRPrBase(egrPrBase).getObject());
        }
        return this;
    }

    public CTRPrChangeBuilder.RPrBuilder getRPrBuilder() {
        return rPrBuilder;
    }

    public CTRPrChangeBuilder withAuthor(String value) {
        if (value!= null) {
            object.setAuthor(value);
        }
        return this;
    }

    public CTRPrChangeBuilder withDate(XMLGregorianCalendar value) {
        if (value!= null) {
            object.setDate(value);
        }
        return this;
    }

    public CTRPrChangeBuilder withId(BigInteger value) {
        if (value!= null) {
            object.setId(value);
        }
        return this;
    }

    /**
     * Calls setId method.
     * 
     * @param value
     *     Value to set
     * @return
     *     reference to this
     */
    public CTRPrChangeBuilder withId(String value) {
        if (value!= null) {
            object.setId(new BigInteger(value));
        }
        return this;
    }

    /**
     * Calls setId method.
     * 
     * @param value
     *     Value to set
     * @return
     *     reference to this
     */
    public CTRPrChangeBuilder withId(Long value) {
        if (value!= null) {
            object.setId(BigInteger.valueOf(value));
        }
        return this;
    }


    /**
     * Fluent API builder for org.docx4j.wml.CTRPrChange$RPr.
     * 
     */
    public static class RPrBuilder
        extends com.alphasystem.docx4j.builder.OpenXmlBuilder
    {


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

        /**
         * Initialize the builder with given object.
         * 
         * @param object
         *     the given object
         */
        public RPrBuilder(CTRPrChange.RPr 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 RPrBuilder(CTRPrChange.RPr src, CTRPrChange.RPr target) {
            this(target);
            if (src!= null) {
                List egrPrBase = src.getEGRPrBase();
                for (Object o: egrPrBase) {
                    addEGRPrBase(WmlBuilderFactory.cloneObject(o));
                }
            }
        }

        protected CTRPrChange.RPr createObject() {
            return WmlBuilderFactory.OBJECT_FACTORY.createCTRPrChangeRPr();
        }

        public CTRPrChangeBuilder.RPrBuilder addEGRPrBase(Object... value) {
            addContent(object.getEGRPrBase(), value);
            return this;
        }

    }

}