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

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

There is a newer version: 0.5.5
Show newest version

package com.alphasystem.docx4j.builder.wml;

import java.util.List;
import com.alphasystem.docx4j.builder.OpenXmlBuilder;
import org.docx4j.wml.Tc;
import org.docx4j.wml.TcPr;


/**
 * Fluent API builder for org.docx4j.wml.Tc.
 * 
 */
public class TcBuilder
    extends OpenXmlBuilder
{


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

    /**
     * Initialize the builder with given object.
     * 
     * @param object
     *     the given object
     */
    public TcBuilder(Tc 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 TcBuilder(Tc src, Tc target) {
        this(target);
        if (src!= null) {
            TcPr tcPr = src.getTcPr();
            if (tcPr!= null) {
                tcPr = new TcPrBuilder(tcPr, object.getTcPr()).getObject();
            }
            List content = src.getContent();
            for (Object o: content) {
                addContent(WmlBuilderFactory.cloneObject(o));
            }
            withTcPr(tcPr);
        }
    }

    protected Tc createObject() {
        return WmlBuilderFactory.OBJECT_FACTORY.createTc();
    }

    public TcBuilder withTcPr(TcPr value) {
        if (value!= null) {
            object.setTcPr(value);
        }
        return this;
    }

    public TcBuilder addContent(Object... value) {
        addContent(object.getContent(), value);
        return this;
    }

}