aderesh
aderesh

Reputation: 957

Generate non Schema classes/annotations in XJC Plugin

I'm writing a custom plugin for XJC. I need XJC to generate extra classes which are not in the XSD Schema. How can I do that?

In run(Outline model, ...) we have access to model.getClasses() which are of a ClassOutline type. The problem is I need to add JDefinedClass, but I don't know where to add it. Each ClassOutline has only one implClass which I cannot replace or add.

Upvotes: 1

Views: 155

Answers (1)

giro
giro

Reputation: 431

private static void addAnotherClass(Outline model, String fullyQualifiedName) throws JClassAlreadyExistsException {
    model.getCodeModel()._class(fullyQualifiedName);
}

This will generate an empty class when called from the overridden run method of your XJC Plugin.

Upvotes: 1

Related Questions