Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Node interface, implement it in Attribute and Content #137

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/src/java/org/jdom2/Attribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

package org.jdom2;

import org.jdom2.nodes.Node;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -80,7 +82,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* @author Rolf Lear
*/
public class Attribute extends CloneBase
implements NamespaceAware, Serializable, Cloneable {
implements NamespaceAware, Serializable, Cloneable, Node {

/**
* JDOM 2.0.0 Serialization version. Attribute is simple
Expand Down Expand Up @@ -464,6 +466,7 @@ public Attribute setNamespace(Namespace namespace) {
*
* @return <code>String</code> - value for this attribute.
*/
@Override
public String getValue() {
return value;
}
Expand Down
10 changes: 3 additions & 7 deletions core/src/java/org/jdom2/Content.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

package org.jdom2;

import org.jdom2.nodes.Node;

import java.io.*;
import java.util.Collections;
import java.util.List;
Expand All @@ -75,7 +77,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* @author Rolf Lear
*/
public abstract class Content extends CloneBase
implements Serializable, NamespaceAware {
implements Serializable, NamespaceAware, Node {

/**
* JDOM2 Serialization.
Expand Down Expand Up @@ -231,12 +233,6 @@ public Document getDocument() {
return parent.getDocument();
}


/**
* Returns the XPath 1.0 string value of this child.
*
* @return xpath string value of this child.
*/
public abstract String getValue();

@Override
Expand Down
10 changes: 10 additions & 0 deletions core/src/java/org/jdom2/nodes/Node.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.jdom2.nodes;

public interface Node {
/**
* Returns the XPath 1.0 string value of this child.
*
* @return xpath string value of this child.
*/
public String getValue();
}