I'm trying to add package level annotations but I don't have a clue on how to do it. Examples are appreciated.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
In eclipse
Since package-info.java isn't a valid identifier for a class it cannot be created as a class in Eclipse.
I found that when you create a new package there is a check box to check if you want a package-info.java.
To create a package-info.java file in an existing package:
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.java file and add the package declaration that it relates to in the file. In fact, the only thing the package-info.java file must contain is the package declaration.
Open explorer, go to src/your package folder.
right click -> Create new textfile: name it package-info.java.
Go back to eclipse and edit and add the desired content.
Summary from the article here
In package-info.java:
In PackageLevelAnnotation.java
Edit: more package level info. Here is a link to the package chapter in the Java Language Spec: packages