Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does package-info.java work? [duplicate]

Tags:

java

jaxb

When I generate Java files from XML Schema using JAXB, package-info.java file is generated.

What is this file for? and how does it work?

Especially, this file contains annotation like below.

@javax.xml.bind.annotation.XmlSchema(namespace = "http://searchrequest")

What does this mean? I doubt this does something with javadoc or Eclipse Juno.

This should be something specific with JAXB, isn't it?

like image 828
Hashim Otto Avatar asked Feb 20 '14 06:02

Hashim Otto


People also ask

What is the purpose of package-info 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.

What is Package-info Java in JAXB?

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).


1 Answers

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.

It Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is generally preferred over package.html.

For more information visit:

http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javadoc.html#packagecomment

http://www.intertech.com/Blog/whats-package-info-java-for/

like image 135
Ankur Lathi Avatar answered Oct 08 '22 04:10

Ankur Lathi