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

com.alphasystem.docx4j.builder.wml.NumberingBuilder 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 org.docx4j.wml.Numbering;


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

    private NumberingBuilder.NumIdMacAtCleanupBuilder numIdMacAtCleanupBuilder;

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

    /**
     * Initialize the builder with given object.
     * 
     * @param object
     *     the given object
     */
    public NumberingBuilder(Numbering object) {
        super(object);
        numIdMacAtCleanupBuilder = new NumberingBuilder.NumIdMacAtCleanupBuilder(this.object.getNumIdMacAtCleanup());
    }

    /**
     * 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 NumberingBuilder(Numbering src, Numbering target) {
        this(target);
        if (src!= null) {
            List numPicBullet = src.getNumPicBullet();
            for (Numbering.NumPicBullet o: numPicBullet) {
                addNumPicBullet(new NumberingNumPicBulletBuilder(o, null).getObject());
            }
            List abstractNum = src.getAbstractNum();
            for (Numbering.AbstractNum o: abstractNum) {
                addAbstractNum(new NumberingAbstractNumBuilder(o, null).getObject());
            }
            List num = src.getNum();
            for (Numbering.Num o: num) {
                addNum(new NumberingNumBuilder(o, null).getObject());
            }
            Numbering.NumIdMacAtCleanup numIdMacAtCleanup = src.getNumIdMacAtCleanup();
            if (numIdMacAtCleanup!= null) {
                numIdMacAtCleanup = new NumberingBuilder.NumIdMacAtCleanupBuilder(numIdMacAtCleanup, object.getNumIdMacAtCleanup()).getObject();
            }
            withIgnorable(src.getIgnorable()).withNumIdMacAtCleanup(numIdMacAtCleanup);
        }
    }

    protected Numbering createObject() {
        return WmlBuilderFactory.OBJECT_FACTORY.createNumbering();
    }

    public NumberingBuilder withIgnorable(String value) {
        if (value!= null) {
            object.setIgnorable(value);
        }
        return this;
    }

    public NumberingBuilder addNumPicBullet(Numbering.NumPicBullet... value) {
        addContent(object.getNumPicBullet(), value);
        return this;
    }

    public NumberingBuilder addAbstractNum(Numbering.AbstractNum... value) {
        addContent(object.getAbstractNum(), value);
        return this;
    }

    public NumberingBuilder addNum(Numbering.Num... value) {
        addContent(object.getNum(), value);
        return this;
    }

    public NumberingBuilder withNumIdMacAtCleanup(Numbering.NumIdMacAtCleanup value) {
        if (value!= null) {
            object.setNumIdMacAtCleanup(value);
        }
        return this;
    }

    public NumberingBuilder withNumIdMacAtCleanup(Long val) {
        boolean initialized = (val!= null);
        if (initialized) {
            withNumIdMacAtCleanup(numIdMacAtCleanupBuilder.withVal(val).getObject());
        }
        return this;
    }

    public NumberingBuilder.NumIdMacAtCleanupBuilder getNumIdMacAtCleanupBuilder() {
        return numIdMacAtCleanupBuilder;
    }


    /**
     * Fluent API builder for org.docx4j.wml.Numbering$NumIdMacAtCleanup.
     * 
     */
    public static class NumIdMacAtCleanupBuilder
        extends com.alphasystem.docx4j.builder.OpenXmlBuilder
    {


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

        /**
         * Initialize the builder with given object.
         * 
         * @param object
         *     the given object
         */
        public NumIdMacAtCleanupBuilder(Numbering.NumIdMacAtCleanup 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 NumIdMacAtCleanupBuilder(Numbering.NumIdMacAtCleanup src, Numbering.NumIdMacAtCleanup target) {
            this(target);
            if (src!= null) {
                withVal(WmlBuilderFactory.cloneBigInteger(src.getVal()));
            }
        }

        protected Numbering.NumIdMacAtCleanup createObject() {
            return WmlBuilderFactory.OBJECT_FACTORY.createNumberingNumIdMacAtCleanup();
        }

        public NumberingBuilder.NumIdMacAtCleanupBuilder withVal(BigInteger value) {
            if (value!= null) {
                object.setVal(value);
            }
            return this;
        }

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

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

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy