Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is JAXB generated package-info.java

Tags:

java

jaxb

xjc

I'm trying to find some information on what the package-info.java file generated by the JAXB xjc commandline app actually does. All that is in the file is

@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.example.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package the.generated.package.path; 

What is this package-info.java file used for?

like image 983
E-rich Avatar asked Sep 21 '11 14:09

E-rich


People also ask

What is create package-info in Java?

The package-info. java is a Java file that can be added to any Java source package. Its purpose is to provide a home for package level documentation and package level annotations. Simply create the package-info.

What is Package-info Java in Eclipse?

Simply put, package-info is a Java file that can be added to any Java package.

How do you ignore a field in XML response?

Ignore XML Attribute. You can specify ignore="true" or ignore="false". The default value is false. Specifying ignore="false" has no effect on the attribute value assigned when an object of the type specified in the rule is created and no effect on the constraints.


2 Answers

package-info.java is a way to apply java annotations at the package level. In this case Jaxb is using package-level annotations to indicate the namespace, and to specify namespace qualification for attributes (source).

like image 158
piepera Avatar answered Sep 26 '22 01:09

piepera


This is also useful when you generate javadoc

package-info.java - Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is new in JDK 5.0, and is preferred over package.html.

source : http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles

like image 25
kdabir Avatar answered Sep 24 '22 01:09

kdabir