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

Fix typed IDREF(S) elements compilation error #12 #13

Merged
merged 2 commits into from
Mar 17, 2018
Merged
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 src/main/java/com/massfords/jaxb/ClassDiscoverer.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ private static boolean foundWithinOutline(String s, Outline outline) {

private static void addIfDirectClass(Set<String> directClassNames, JType collType) {
if (collType.getClass().getName().equals("com.sun.codemodel.JDirectClass")) {
directClassNames.add(collType.fullName());
//Skip if the `direct`class is also available as JDefinedClass (see ISSUE-12).
if(collType.owner()._getClass(collType.fullName()) == null){
directClassNames.add(collType.fullName());
}
}
}

Expand Down
43 changes: 43 additions & 0 deletions src/test/java/com/massfords/jaxb/ExcludeIDRefTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.massfords.jaxb;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo;
import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo;

public class ExcludeIDRefTest extends RunXJC2Mojo {
private GeneratedCodeFixture generatedCodeFixture = new GeneratedCodeFixture(
"src/test/resources/vec-expected/{0}.java.txt",
"target/generated-sources/xjc/org/prostep/ecadif/vec113/visitor/{0}.java");

@Override
public File getSchemaDirectory() {
return new File(getBaseDir(), "src/test/resources/vec/");
}

@Override
protected void configureMojo(AbstractXJC2Mojo mojo) {
super.configureMojo(mojo);
mojo.setBindingDirectory(getSchemaDirectory());
mojo.setForceRegenerate(true);
mojo.setExtension(true);
}

@Override
public List<String> getArgs() {
final List<String> args = new ArrayList<>(super.getArgs());
args.add("-Xvisitor");
args.add("-Xvisitor-package:org.prostep.ecadif.vec113.visitor");
return args;
}

@Override
public void testExecute() throws Exception {
super.testExecute();

generatedCodeFixture.assertAllFiles();
}

}
43 changes: 43 additions & 0 deletions src/test/resources/vec-expected/BaseVisitor.java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2018.02.21 um 12:34:49 PM CET
//


package org.prostep.ecadif.vec113.visitor;

import javax.annotation.Generated;
import org.prostep.ecadif.vec113.VecContent;
import org.prostep.ecadif.vec113.VecDocumentVersion;
import org.prostep.ecadif.vec113.VecPartVersion;

@Generated("Generated by jaxb-visitor")
public class BaseVisitor<R, E extends Throwable >
implements Visitor<R, E>
{


@Override
public R visit(VecContent aBean)
throws E
{
return null;
}

@Override
public R visit(VecDocumentVersion aBean)
throws E
{
return null;
}

@Override
public R visit(VecPartVersion aBean)
throws E
{
return null;
}

}
46 changes: 46 additions & 0 deletions src/test/resources/vec-expected/DepthFirstTraverserImpl.java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2018.02.21 um 12:34:49 PM CET
//


package org.prostep.ecadif.vec113.visitor;

import javax.annotation.Generated;
import org.prostep.ecadif.vec113.VecContent;
import org.prostep.ecadif.vec113.VecDocumentVersion;
import org.prostep.ecadif.vec113.VecPartVersion;

@Generated("Generated by jaxb-visitor")
public class DepthFirstTraverserImpl<E extends Throwable >
implements Traverser<E>
{


@Override
public void traverse(VecContent aBean, Visitor<?, E> aVisitor)
throws E
{
for (VecDocumentVersion bean: aBean.getDocumentVersions()) {
bean.accept(aVisitor);
}
for (VecPartVersion bean: aBean.getPartVersions()) {
bean.accept(aVisitor);
}
}

@Override
public void traverse(VecDocumentVersion aBean, Visitor<?, E> aVisitor)
throws E
{
}

@Override
public void traverse(VecPartVersion aBean, Visitor<?, E> aVisitor)
throws E
{
}

}
32 changes: 32 additions & 0 deletions src/test/resources/vec-expected/Traverser.java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2018.02.21 um 12:34:49 PM CET
//


package org.prostep.ecadif.vec113.visitor;

import javax.annotation.Generated;
import org.prostep.ecadif.vec113.VecContent;
import org.prostep.ecadif.vec113.VecDocumentVersion;
import org.prostep.ecadif.vec113.VecPartVersion;

@Generated("Generated by jaxb-visitor")
public interface Traverser<E extends Throwable >{


void traverse(VecContent aBean, Visitor<?, E> aVisitor)
throws E
;

void traverse(VecDocumentVersion aBean, Visitor<?, E> aVisitor)
throws E
;

void traverse(VecPartVersion aBean, Visitor<?, E> aVisitor)
throws E
;

}
135 changes: 135 additions & 0 deletions src/test/resources/vec-expected/TraversingVisitor.java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2018.02.21 um 12:34:49 PM CET
//


package org.prostep.ecadif.vec113.visitor;

import javax.annotation.Generated;
import org.prostep.ecadif.vec113.VecContent;
import org.prostep.ecadif.vec113.VecDocumentVersion;
import org.prostep.ecadif.vec113.VecPartVersion;

@Generated("Generated by jaxb-visitor")
public class TraversingVisitor<R, E extends Throwable >
implements Visitor<R, E>
{

private boolean traverseFirst;
private Visitor<R, E> visitor;
private Traverser<E> traverser;
private TraversingVisitorProgressMonitor progressMonitor;

public TraversingVisitor(Traverser<E> aTraverser, Visitor<R, E> aVisitor) {
traverser = aTraverser;
visitor = aVisitor;
}

public boolean getTraverseFirst() {
return traverseFirst;
}

public void setTraverseFirst(boolean aVisitor) {
traverseFirst = aVisitor;
}

public Visitor<R, E> getVisitor() {
return visitor;
}

public void setVisitor(Visitor<R, E> aVisitor) {
visitor = aVisitor;
}

public Traverser<E> getTraverser() {
return traverser;
}

public void setTraverser(Traverser<E> aVisitor) {
traverser = aVisitor;
}

public TraversingVisitorProgressMonitor getProgressMonitor() {
return progressMonitor;
}

public void setProgressMonitor(TraversingVisitorProgressMonitor aVisitor) {
progressMonitor = aVisitor;
}

@Override
public R visit(VecContent aBean)
throws E
{
if (traverseFirst == true) {
getTraverser().traverse(aBean, this);
if (progressMonitor!= null) {
progressMonitor.traversed(aBean);
}
}
R returnVal;
returnVal = aBean.accept(getVisitor());
if (progressMonitor!= null) {
progressMonitor.visited(aBean);
}
if (traverseFirst == false) {
getTraverser().traverse(aBean, this);
if (progressMonitor!= null) {
progressMonitor.traversed(aBean);
}
}
return returnVal;
}

@Override
public R visit(VecDocumentVersion aBean)
throws E
{
if (traverseFirst == true) {
getTraverser().traverse(aBean, this);
if (progressMonitor!= null) {
progressMonitor.traversed(aBean);
}
}
R returnVal;
returnVal = aBean.accept(getVisitor());
if (progressMonitor!= null) {
progressMonitor.visited(aBean);
}
if (traverseFirst == false) {
getTraverser().traverse(aBean, this);
if (progressMonitor!= null) {
progressMonitor.traversed(aBean);
}
}
return returnVal;
}

@Override
public R visit(VecPartVersion aBean)
throws E
{
if (traverseFirst == true) {
getTraverser().traverse(aBean, this);
if (progressMonitor!= null) {
progressMonitor.traversed(aBean);
}
}
R returnVal;
returnVal = aBean.accept(getVisitor());
if (progressMonitor!= null) {
progressMonitor.visited(aBean);
}
if (traverseFirst == false) {
getTraverser().traverse(aBean, this);
if (progressMonitor!= null) {
progressMonitor.traversed(aBean);
}
}
return returnVal;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2018.02.21 um 12:34:49 PM CET
//


package org.prostep.ecadif.vec113.visitor;

import javax.annotation.Generated;

@Generated("Generated by jaxb-visitor")
public interface TraversingVisitorProgressMonitor {


void visited(Object aVisitable);

void traversed(Object aVisitable);

}
21 changes: 21 additions & 0 deletions src/test/resources/vec-expected/Visitable.java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2018.02.21 um 12:34:49 PM CET
//


package org.prostep.ecadif.vec113.visitor;

import javax.annotation.Generated;

@Generated("Generated by jaxb-visitor")
public interface Visitable {


<R, E extends Throwable >R accept(Visitor<R, E> aVisitor)
throws E
;

}
32 changes: 32 additions & 0 deletions src/test/resources/vec-expected/Visitor.java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2018.02.21 um 12:34:49 PM CET
//


package org.prostep.ecadif.vec113.visitor;

import javax.annotation.Generated;
import org.prostep.ecadif.vec113.VecContent;
import org.prostep.ecadif.vec113.VecDocumentVersion;
import org.prostep.ecadif.vec113.VecPartVersion;

@Generated("Generated by jaxb-visitor")
public interface Visitor<R, E extends Throwable >{


R visit(VecContent aBean)
throws E
;

R visit(VecDocumentVersion aBean)
throws E
;

R visit(VecPartVersion aBean)
throws E
;

}
Loading