Skip to content

Commit

Permalink
feat(objectionary#715): parse class interfaces from Xmir
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Sep 23, 2024
1 parent 721f23c commit 80d3bcf
Showing 1 changed file with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.eolang.jeo.representation.xmir;

import java.util.Collection;
import java.util.Optional;
import org.eolang.jeo.representation.DefaultVersion;
import org.eolang.jeo.representation.bytecode.BytecodeClassProperties;
Expand Down Expand Up @@ -135,11 +136,29 @@ private String supername() {
* @return Interfaces.
*/
private String[] interfaces() {
return this.clazz.xpath("./o[@name='interfaces']/o/text()")
.stream()
.map(HexString::new)
.map(HexString::decode)
.toArray(String[]::new);
return this.clazz.optchild("name", "interfaces")
.map(
node -> node.children()
.map(XmlValue::new)
.map(XmlValue::bytes)
.map(XmlBytes::hex)
.map(HexString::decode).toArray(String[]::new)

).orElse(new String[0]);

// return
// .flatMap(node -> node.children())
// .map(XmlValue::new)
// .map(XmlValue::bytes)
// .map(XmlBytes::hex)
// .map(HexString::decode)
// .orElse(new String[0]);
//
// return this.clazz.xpath("./o[@name='interfaces']/o/text()")
// .stream()
// .map(HexString::new)
// .map(HexString::decode)
// .toArray(String[]::new);
}

/**
Expand Down

0 comments on commit 80d3bcf

Please sign in to comment.