Top Description Constructors Methods
com.sun.tools.xjc

public abstract Class XJCListener

extends Object
implements ErrorListener
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.api.ErrorListener, org.glassfish.jaxb.core.api.ErrorListener, org.xml.sax.ErrorHandler
Imports
java.io.PrintStream, com.sun.tools.xjc.api.ErrorListener, com.sun.tools.xjc.outline.Outline

Call-back interface that can be implemented by the caller of Driver to receive output from XJC.

Most of the messages XJC produce once the real work starts is structured as (message,source). Those outputs will be reported to various methods on ErrorListener, which is inherited by this interface.

The other messages (such as the usage screen when there was an error in the command line option) will go to the message(String) method.

Author
Kohsuke Kawaguchi
Since
JAXB 2.0 EA

Constructor Summary

AccessConstructor and Description
public
XJCListener()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
compiled(Outline
never null. this is the root object that represents the code generation strategy.
outline
)

Called after the schema is compiled and the code generation strategy is determined, but before any code is actually generated as files.

public void
generatedFile(String
file names like "org/acme/foo/Foo.java" or "org/acme/foo/jaxb.properties".
fileName
,
int current, int total)

Called for each file generated by XJC.

public boolean

Returns:

true if the wants to abort the processing.
isCanceled
()

XJC will periodically invoke this method to see if it should cancel a compilation.

public void
message(String msg)

Other miscellenous messages that do not have structures will be reported through this method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

XJCListenerback to summary
public XJCListener()

Default constructor.

Method Detail

compiledback to summary
public void compiled(Outline outline)

Called after the schema is compiled and the code generation strategy is determined, but before any code is actually generated as files.

Parameters
outline:Outline

never null. this is the root object that represents the code generation strategy.

generatedFileback to summary
public void generatedFile(String fileName, int current, int total)

Called for each file generated by XJC.

XJC may generate not only source files but also resources files. The file name includes the path portions that correspond with the package name.

When generating files into a directory, file names will be relative to the output directory. When generating files into a zip file, file names will be those in the zip file.

Parameters
fileName:String

file names like "org/acme/foo/Foo.java" or "org/acme/foo/jaxb.properties".

Since
2.0.1
isCanceledback to summary
public boolean isCanceled()

XJC will periodically invoke this method to see if it should cancel a compilation.

As long as this method returns false, XJC will keep going. If this method ever returns true, XJC will abort the processing right away and returns non-zero from Driver#run(String[], XJCListener). Note that XJC will not report an abortion through the message(String) method.

Note that despite all the efforts to check this method frequently, XJC may still fail to invoke this method for a long time. Such scenario would include network related problems or other I/O block (you can't even interrupt the thread while I/O is blocking.) So just beware that this is not a cure-all.

Returns:boolean

true if the wants to abort the processing.

Since
2.1
messageback to summary
public void message(String msg)

Other miscellenous messages that do not have structures will be reported through this method. This method is used like PrintStream#println(String). The callee is expected to add '\n'.