Skip to content

Commit

Permalink
#445 - Refactored XmlMethodSignature.
Browse files Browse the repository at this point in the history
  • Loading branch information
vzurauskas committed May 1, 2020
1 parent f64b6ad commit dbe1522
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions src/main/java/org/jpeek/graph/XmlMethodSignature.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,29 @@
package org.jpeek.graph;

import com.jcabi.xml.XML;
import org.cactoos.Text;
import org.cactoos.text.Joined;
import org.cactoos.text.TextEnvelope;
import org.cactoos.text.TextOf;

/**
* Text signature of a class method, extracted from XML Skeleton.
* @since 0.30.9
*/
public final class XmlMethodSignature implements Text {
public final class XmlMethodSignature extends TextEnvelope {

/**
* The class element of XML skeleton.
*/
private final XML clazz;

/**
* The method element of XML skeleton.
*/
private final XML method;

/**
* Primary ctor.
* Ctor.
* @param clazz The class element of XML skeleton.
* @param method The method element of XML skeleton.
*/
public XmlMethodSignature(final XML clazz, final XML method) {
this.clazz = clazz;
this.method = method;
}

@Override
public String asString() throws Exception {
return new Joined(
"", this.clazz.xpath("./@id").get(0),
".", this.method.xpath("@name").get(0),
".", new XmlMethodArgs(this.method).asString()
).asString();
super(
new Joined(
new TextOf("."),
new TextOf(clazz.xpath("./@id").get(0)),
new TextOf(method.xpath("@name").get(0)),
new XmlMethodArgs(method)
)
);
}
}

0 comments on commit dbe1522

Please sign in to comment.