Skip to content

Commit

Permalink
Autodoc refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Oct 3, 2023
1 parent 8e89c0e commit 1264560
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
package org.fugerit.java.doc.lib.autodoc.parser.model;

import java.util.stream.Stream;

import org.xmlet.xsdparser.xsdelements.XsdChoice;
import org.xmlet.xsdparser.xsdelements.XsdElement;
import org.xmlet.xsdparser.xsdelements.XsdSequence;

public class AutodocChoice extends AutodocMulti {
public class AutodocChoice extends AutodocMulti<XsdChoice> {


/**
*
*/
private static final long serialVersionUID = 6551113305251367239L;

public XsdChoice getContent() {
return content;
}

private transient XsdChoice content;

public AutodocChoice(XsdChoice content) {
super();
this.content = content;
}

@Override
protected Stream<XsdElement> getElementsStream() {
return this.getContent().getChildrenElements();
}


@Override
protected Stream<XsdChoice> getChoiceStream() {
return this.getContent().getChildrenChoices();
}

@Override
protected Stream<XsdSequence> getSequencesStream() {
return this.getContent().getChildrenSequences();
super(content);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,38 @@

import org.xmlet.xsdparser.xsdelements.XsdChoice;
import org.xmlet.xsdparser.xsdelements.XsdElement;
import org.xmlet.xsdparser.xsdelements.XsdMultipleElements;
import org.xmlet.xsdparser.xsdelements.XsdSequence;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public abstract class AutodocMulti implements Serializable {
public abstract class AutodocMulti<T extends XsdMultipleElements> implements Serializable {

/**
*
*/
private static final long serialVersionUID = 5741209190264158477L;

protected abstract Stream<XsdElement> getElementsStream();

protected abstract Stream<XsdChoice> getChoiceStream();

protected abstract Stream<XsdSequence> getSequencesStream();
protected Stream<XsdElement> getElementsStream() {
return this.content.getChildrenElements();
}

protected Stream<XsdChoice> getChoiceStream() {
return this.content.getXsdElements().filter(XsdChoice.class::isInstance).map(XsdChoice.class::cast);
}

protected Stream<XsdSequence> getSequencesStream() {
return this.content.getXsdElements().filter(XsdSequence.class::isInstance).map(XsdSequence.class::cast);
}

protected AutodocMulti(T content) {
super();
this.content = content;
}

@Getter protected transient T content;

public Collection<XsdElement> getXsdElements() {
List<XsdElement> result = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
package org.fugerit.java.doc.lib.autodoc.parser.model;

import java.util.stream.Stream;

import org.xmlet.xsdparser.xsdelements.XsdChoice;
import org.xmlet.xsdparser.xsdelements.XsdElement;
import org.xmlet.xsdparser.xsdelements.XsdSequence;

public class AutodocSequence extends AutodocMulti {
public class AutodocSequence extends AutodocMulti<XsdSequence> {

/**
*
*/
private static final long serialVersionUID = -3570826182659230472L;

public XsdSequence getContent() {
return content;
}

private transient XsdSequence content;

public AutodocSequence(XsdSequence content) {
super();
this.content = content;
}

@Override
protected Stream<XsdElement> getElementsStream() {
return this.getContent().getChildrenElements();
}


@Override
protected Stream<XsdChoice> getChoiceStream() {
return this.getContent().getChildrenChoices();
}

@Override
protected Stream<XsdSequence> getSequencesStream() {
return this.getContent().getChildrenSequences();
super(content);
}

}

0 comments on commit 1264560

Please sign in to comment.