public class PomTransformer extends Object
pom.xml files on the DOM level while keeping the original comments and formatting also
on places where common javax.xml.transform.Transformer or javax.xml.parsers.DocumentBuilder based
solutions tend to fail, such as
| Modifier and Type | Class and Description |
|---|---|
static interface |
PomTransformer.Transformation
A transformation of a DOM
|
static class |
PomTransformer.TransformationContext
A context of a set of
PomTransformer.Transformations. |
| Modifier and Type | Field and Description |
|---|---|
(package private) static Pattern |
EOL_PATTERN |
(package private) static Pattern[] |
POSTPROCESS_PATTERNS |
| Constructor and Description |
|---|
PomTransformer(Path path,
Charset charset) |
| Modifier and Type | Method and Description |
|---|---|
(package private) static String |
anyNs(String... elements)
A generator of XPath 1.0 "any namespace" selector, such as
/*:[local-name()='foo']/*:[local-name()='bar']. |
(package private) static String |
detectEol(String src) |
(package private) static String |
detectIndentation(Node document,
XPath xPath) |
(package private) static String |
postprocess(String src,
String result) |
void |
transform(Collection<PomTransformer.Transformation> transformations)
Loads the document under
path, applies the given transformations, mitigates the formatting
issues caused by Transformer and finally stores the document back to the file under path. |
(package private) static void |
transform(Collection<PomTransformer.Transformation> edits,
Path path,
Supplier<String> source,
Consumer<String> outConsumer) |
void |
transform(PomTransformer.Transformation... transformations)
Loads the document under
path, applies the given transformations, mitigates the formatting
issues caused by Transformer and finally stores the document back to the file under path. |
static final Pattern[] POSTPROCESS_PATTERNS
static final Pattern EOL_PATTERN
public void transform(PomTransformer.Transformation... transformations)
path, applies the given transformations, mitigates the formatting
issues caused by Transformer and finally stores the document back to the file under path.transformations - the PomTransformer.Transformations to applypublic void transform(Collection<PomTransformer.Transformation> transformations)
path, applies the given transformations, mitigates the formatting
issues caused by Transformer and finally stores the document back to the file under path.transformations - the PomTransformer.Transformations to applystatic void transform(Collection<PomTransformer.Transformation> edits, Path path, Supplier<String> source, Consumer<String> outConsumer)
static String anyNs(String... elements)
/*:[local-name()='foo']/*:[local-name()='bar']. In XPath 2.0, this would be just /*:foo/*:bar,
but as of Java 13, there is only XPath 1.0 available in the JDK.elements - namespace-less element namesCopyright © 2019 JBoss by Red Hat. All rights reserved.