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

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


package com.alphasystem.docx4j.builder.wml;

import java.util.List;
import com.alphasystem.docx4j.builder.OpenXmlBuilder;
import org.docx4j.wml.P;
import org.docx4j.wml.PPr;


/**
 * Fluent API builder for org.docx4j.wml.P.
 * 
 */
public class PBuilder
    extends OpenXmlBuilder

{ /** * Initialize the underlying object. * */ public PBuilder() { this(null); } /** * Initialize the builder with given object. * * @param object * the given object */ public PBuilder(P 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 PBuilder(P src, P target) { this(target); if (src!= null) { PPr pPr = src.getPPr(); if (pPr!= null) { pPr = new PPrBuilder(pPr, object.getPPr()).getObject(); } List content = src.getContent(); for (Object o: content) { addContent(WmlBuilderFactory.cloneObject(o)); } withPPr(pPr).withRsidRPr(src.getRsidRPr()).withRsidR(src.getRsidR()).withRsidDel(src.getRsidDel()).withRsidP(src.getRsidP()).withRsidRDefault(src.getRsidRDefault()).withParaId(src.getParaId()).withTextId(src.getTextId()); } } protected P createObject() { return WmlBuilderFactory.OBJECT_FACTORY.createP(); } public PBuilder withPPr(PPr value) { if (value!= null) { object.setPPr(value); } return this; } public PBuilder addContent(Object... value) { addContent(object.getContent(), value); return this; } public PBuilder withRsidRPr(String value) { if (value!= null) { object.setRsidRPr(value); } return this; } public PBuilder withRsidR(String value) { if (value!= null) { object.setRsidR(value); } return this; } public PBuilder withRsidDel(String value) { if (value!= null) { object.setRsidDel(value); } return this; } public PBuilder withRsidP(String value) { if (value!= null) { object.setRsidP(value); } return this; } public PBuilder withRsidRDefault(String value) { if (value!= null) { object.setRsidRDefault(value); } return this; } public PBuilder withParaId(String value) { if (value!= null) { object.setParaId(value); } return this; } public PBuilder withTextId(String value) { if (value!= null) { object.setTextId(value); } return this; } }