1 | package pro.verron.officestamper.core; | |
2 | ||
3 | import org.docx4j.jaxb.Context; | |
4 | import org.docx4j.wml.ObjectFactory; | |
5 | import org.docx4j.wml.P; | |
6 | import org.docx4j.wml.R; | |
7 | import pro.verron.officestamper.api.OfficeStamperException; | |
8 | ||
9 | /** | |
10 | * Utility class for creating paragraphs. | |
11 | * | |
12 | * @author Joseph Verron | |
13 | * @author Tom Hombergs | |
14 | * @version ${version} | |
15 | * @since 1.0.0 | |
16 | */ | |
17 | public class ParagraphUtil { | |
18 | ||
19 | private ParagraphUtil() { | |
20 | throw new OfficeStamperException("Utility class shouldn't be instantiated"); | |
21 | } | |
22 | ||
23 | private static final ObjectFactory objectFactory = Context.getWmlObjectFactory(); | |
24 | ||
25 | /** | |
26 | * Creates a new paragraph. | |
27 | * | |
28 | * @param texts the text of this paragraph. | |
29 | * If more than one text is specified, | |
30 | * each text will be placed within its own Run. | |
31 | * @return a new paragraph containing the given text. | |
32 | */ | |
33 | public static P create(String... texts) { | |
34 | P p = objectFactory.createP(); | |
35 | for (String text : texts) { | |
36 | R r = RunUtil.create(text, p.getPPr()); | |
37 | p.getContent().add(r); | |
38 | } | |
39 |
1
1. create : replaced return value with null for pro/verron/officestamper/core/ParagraphUtil::create → KILLED |
return p; |
40 | } | |
41 | } | |
Mutations | ||
39 |
1.1 |