This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch 11582 in repository https://gitbox.apache.org/repos/asf/maven.git
commit 82ac13cca41b2ca0b01835cd0e8fd8e44ffac8d8 Author: Elliotte Rusty Harold <[email protected]> AuthorDate: Sun Dec 21 07:15:46 2025 -0500 wip --- .../java/org/apache/maven/api/xml/XmlNode.java | 128 +++------------------ .../org/apache/maven/internal/xml/XmlNodeImpl.java | 55 +-------- 2 files changed, 21 insertions(+), 162 deletions(-) diff --git a/api/maven-api-xml/src/main/java/org/apache/maven/api/xml/XmlNode.java b/api/maven-api-xml/src/main/java/org/apache/maven/api/xml/XmlNode.java index a78357a091..0f6177e994 100644 --- a/api/maven-api-xml/src/main/java/org/apache/maven/api/xml/XmlNode.java +++ b/api/maven-api-xml/src/main/java/org/apache/maven/api/xml/XmlNode.java @@ -109,73 +109,6 @@ public interface XmlNode { @Deprecated(since = "4.0.0", forRemoval = true) String DEFAULT_SELF_COMBINATION_MODE = XmlService.DEFAULT_SELF_COMBINATION_MODE; - /** - * Returns the local name of this XML node. - * - * @return the node name, never {@code null} - */ - @Nonnull - String name(); - - /** - * Returns the namespace URI of this XML node. - * - * @return the namespace URI, never {@code null} (empty string if no namespace) - */ - @Nonnull - String namespaceUri(); - - /** - * Returns the namespace prefix of this XML node. - * - * @return the namespace prefix, never {@code null} (empty string if no prefix) - */ - @Nonnull - String prefix(); - - /** - * Returns the text content of this XML node. - * - * @return the node's text value, or {@code null} if none exists - */ - @Nullable - String value(); - - /** - * Returns an immutable map of all attributes defined on this XML node. - * - * @return map of attribute names to values, never {@code null} - */ - @Nonnull - Map<String, String> attributes(); - - /** - * Returns the value of a specific attribute. - * - * @param name the name of the attribute to retrieve - * @return the attribute value, or {@code null} if the attribute doesn't exist - * @throws NullPointerException if name is null - */ - @Nullable - String attribute(@Nonnull String name); - - /** - * Returns an immutable list of all child nodes. - * - * @return list of child nodes, never {@code null} - */ - @Nonnull - List<XmlNode> children(); - - /** - * Returns the first child node with the specified name. - * - * @param name the name of the child node to find - * @return the first matching child node, or {@code null} if none found - */ - @Nullable - XmlNode child(String name); - /** * Returns the input location information for this node, if available. * This can be useful for error reporting and debugging. @@ -185,60 +118,33 @@ public interface XmlNode { @Nullable Object inputLocation(); - // Deprecated methods that delegate to new ones - @Deprecated(since = "4.0.0", forRemoval = true) + @Nonnull - default String getName() { - return name(); - } + String getName(); - @Deprecated(since = "4.0.0", forRemoval = true) @Nonnull - default String getNamespaceUri() { - return namespaceUri(); - } + String getNamespaceUri(); - @Deprecated(since = "4.0.0", forRemoval = true) @Nonnull - default String getPrefix() { - return prefix(); - } + String getPrefix(); - @Deprecated(since = "4.0.0", forRemoval = true) @Nullable - default String getValue() { - return value(); - } + String getValue(); - @Deprecated(since = "4.0.0", forRemoval = true) @Nonnull - default Map<String, String> getAttributes() { - return attributes(); - } + Map<String, String> getAttributes(); - @Deprecated(since = "4.0.0", forRemoval = true) @Nullable - default String getAttribute(@Nonnull String name) { - return attribute(name); - } + String getAttribute(@Nonnull String name); - @Deprecated(since = "4.0.0", forRemoval = true) @Nonnull - default List<XmlNode> getChildren() { - return children(); - } + List<XmlNode> getChildren(); - @Deprecated(since = "4.0.0", forRemoval = true) @Nullable - default XmlNode getChild(String name) { - return child(name); - } + XmlNode getChild(String name); - @Deprecated(since = "4.0.0", forRemoval = true) @Nullable - default Object getInputLocation() { - return inputLocation(); - } + Object getInputLocation(); /** * @deprecated use {@link XmlService#merge(XmlNode, XmlNode, Boolean)} instead @@ -477,17 +383,17 @@ private record Impl( } @Override - public String attribute(@Nonnull String name) { + public String getAttribute(@Nonnull String name) { return attributes.get(name); } @Override - public XmlNode child(String name) { + public XmlNode getChild(String name) { if (name != null) { ListIterator<XmlNode> it = children.listIterator(children.size()); while (it.hasPrevious()) { XmlNode child = it.previous(); - if (name.equals(child.name())) { + if (name.equals(child.getName())) { return child; } } @@ -499,10 +405,10 @@ public XmlNode child(String name) { public boolean equals(Object o) { return this == o || o instanceof XmlNode that - && Objects.equals(this.name, that.name()) - && Objects.equals(this.value, that.value()) - && Objects.equals(this.attributes, that.attributes()) - && Objects.equals(this.children, that.children()); + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.value, that.getValue()) + && Objects.equals(this.attributes, that.getAttributes()) + && Objects.equals(this.children, that.getChildren()); } @Override diff --git a/impl/maven-xml/src/main/java/org/apache/maven/internal/xml/XmlNodeImpl.java b/impl/maven-xml/src/main/java/org/apache/maven/internal/xml/XmlNodeImpl.java index c57eb6e937..89425b12b8 100644 --- a/impl/maven-xml/src/main/java/org/apache/maven/internal/xml/XmlNodeImpl.java +++ b/impl/maven-xml/src/main/java/org/apache/maven/internal/xml/XmlNodeImpl.java @@ -110,36 +110,16 @@ public String getPrefix() { @Override @Nonnull - public String prefix() { - return getPrefix(); - } - - @Override - @Nonnull - @Deprecated(since = "4.0.0", forRemoval = true) public String getNamespaceUri() { return namespaceUri; } @Override @Nonnull - public String namespaceUri() { - return getNamespaceUri(); - } - - @Override - @Nonnull - @Deprecated(since = "4.0.0", forRemoval = true) public String getName() { return name; } - @Override - @Nonnull - public String name() { - return getName(); - } - // ---------------------------------------------------------------------- // Value handling // ---------------------------------------------------------------------- @@ -150,11 +130,6 @@ public String getValue() { return value; } - @Override - public String value() { - return getValue(); - } - // ---------------------------------------------------------------------- // Attribute handling // ---------------------------------------------------------------------- @@ -166,23 +141,12 @@ public Map<String, String> getAttributes() { return attributes; } - @Override - @Nonnull - public Map<String, String> attributes() { - return getAttributes(); - } - @Override @Deprecated(since = "4.0.0", forRemoval = true) public String getAttribute(@Nonnull String name) { return attributes.get(name); } - @Override - public String attribute(@Nonnull String name) { - return getAttribute(name); - } - // ---------------------------------------------------------------------- // Child handling // ---------------------------------------------------------------------- @@ -202,11 +166,6 @@ public XmlNode getChild(String name) { return null; } - @Override - public XmlNode child(String name) { - return getChild(name); - } - @Override @Nonnull @Deprecated(since = "4.0.0", forRemoval = true) @@ -214,12 +173,6 @@ public List<XmlNode> getChildren() { return children; } - @Override - @Nonnull - public List<XmlNode> children() { - return getChildren(); - } - @Deprecated(since = "4.0.0", forRemoval = true) public int getChildCount() { return children.size(); @@ -278,10 +231,10 @@ public static XmlNode merge(XmlNode dominant, XmlNode recessive) { public boolean equals(Object o) { return this == o || o instanceof XmlNode that - && Objects.equals(this.name, that.name()) - && Objects.equals(this.value, that.value()) - && Objects.equals(this.attributes, that.attributes()) - && Objects.equals(this.children, that.children()); + && Objects.equals(this.name, that.getName()) + && Objects.equals(this.value, that.getValue()) + && Objects.equals(this.attributes, that.getAttributes()) + && Objects.equals(this.children, that.getChildren()); } @Override
