JAVA-19117 Create new core-java-documentation sub module under core-java-modules (#13619)

* JAVA-19117 Create new core-java-documentation sub module under core-java-modules
https://team.baeldung.com/browse/JAVA-19117
This commit is contained in:
anuragkumawat
2023-04-11 12:49:28 +05:30
committed by GitHub
parent 1ff95d4cb8
commit 679bf08ea2
8 changed files with 48 additions and 13 deletions

View File

@@ -0,0 +1,6 @@
## Core Java Documentation
### Relevant Articles:
- [Introduction to Javadoc](http://www.baeldung.com/javadoc)

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core-java-documentation</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>core-java-documentation</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung.core-java-modules</groupId>
<artifactId>core-java-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<source>${source.version}</source>
<target>${target.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<!-- maven plugins -->
<maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
<source.version>1.8</source.version>
<target.version>1.8</target.version>
</properties>
</project>

View File

@@ -0,0 +1,154 @@
package com.baeldung.javadoc;
public class CodeSnippetFormatting {
/**
* This is an example to show default behavior of code snippet formatting in Javadocs
*
* public class Application(){
*
* }
*
*/
public void showCodeSnippetFormatting() {
// do nothing
}
/**
* This is an example to show usage of HTML pre tag while code snippet formatting in Javadocs
*
* <pre>
* public class Application(){
* List<Integer> nums = new ArrayList<>();
* }
*
* </pre>
*/
public void showCodeSnippetFormattingUsingPRETag() {
// do nothing
}
/**
* This is an example to show usage of HTML character entities while code snippet formatting in Javadocs
*
* <pre>
* public class Application(){
* List&lt;Integer&gt; nums = new ArrayList<>();
* }
*
* </pre>
*/
public void showCodeSnippetFormattingUsingCharacterEntities() {
// do nothing
}
/**
* This is an example to show usage of javadoc code tag while code snippet formatting in Javadocs
*
* <pre>
*
* public class Application(){
* {@code List<Integer> nums = new ArrayList<>(); }
* }
*
* </pre>
*/
public void showCodeSnippetFormattingUsingCodeTag() {
// do nothing
}
/**
* This is an example to show issue faced while using annotations in Javadocs
*
* <pre>
*
* public class Application(){
* @Getter
* {@code List<Integer> nums = new ArrayList<>(); }
* }
*
* </pre>
*/
public void showCodeSnippetFormattingIssueUsingCodeTag() {
// do nothing
}
/**
* This is an example to show usage of javadoc code tag for handling '@' character
*
* <pre>
*
* public class Application(){
* {@code @Getter}
* {@code List<Integer> nums = new ArrayList<>(); }
* }
*
* </pre>
*/
public void showCodeSnippetAnnotationFormattingUsingCodeTag() {
// do nothing
}
/**
* This is an example to show difference in javadoc literal and code tag
*
* <p>
*
* {@literal @Getter}
* {@literal List<Integer> nums = new ArrayList<>(); }
*
* <br />
* {@code @Getter}
* {@code List<Integer> nums = new ArrayList<>(); }
* </p>
*/
public void showCodeSnippetCommentsFormattingUsingCodeAndLiteralTag() {
// do nothing
}
/**
* This is an example to illustrate a basic jQuery code snippet embedded in documentation comments
* <pre>
* {@code <script>}
* $document.ready(function(){
* console.log("Hello World!);
* })
* {@code </script>}
* </pre>
*/
public void showJSCodeSnippetUsingJavadoc() {
// do nothing
}
/**
* This is an example to illustrate an HTML code snippet embedded in documentation comments
* <pre>{@code
* <html>
* <body>
* <h1>Hello World!</h1>
* </body>
* </html>}
* </pre>
*
*/
public void showHTMLCodeSnippetUsingJavadoc() {
// do nothing
}
/**
* This is an example to illustrate an HTML code snippet embedded in documentation comments
* <pre>
* <html>
* <body>
* <h1>Hello World!</h1>
* </body>
* </html>
* </pre>
*
*/
public void showHTMLCodeSnippetIssueUsingJavadoc() {
// do nothing
}
}

View File

@@ -0,0 +1,22 @@
package com.baeldung.javadoc;
public class Person {
/**
* This is a first name
*/
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}

View File

@@ -0,0 +1,70 @@
package com.baeldung.javadoc;
/**
* Hero is the main entity we will be using to . . .
* @author Captain America
*
*/
public class SuperHero extends Person {
/**
* The public name of a hero that is common knowledge
*/
private String heroName;
private String uniquePower;
private int health;
private int defense;
/**
* <p>This is a simple description of the method. . .
* <a href="http://www.supermanisthegreatest.com">Superman!</a>
* </p>
* @param incomingDamage the amount of incoming damage
* @return the amount of health hero has after attack
* @see <a href="http://www.link_to_jira/HERO-402">HERO-402</a>
* @since 1.0
* @deprecated As of version 1.1, use . . . instead
* @version 1.2
* @throws IllegalArgumentException if incomingDamage is negative
*/
public int successfullyAttacked(int incomingDamage, String damageType) throws Exception {
// do things
if (incomingDamage < 0) {
throw new IllegalArgumentException ("Cannot cause negative damage");
}
return 0;
}
public String getHeroName() {
return heroName;
}
public void setHeroName(String heroName) {
this.heroName = heroName;
}
public String getUniquePower() {
return uniquePower;
}
public void setUniquePower(String uniquePower) {
this.uniquePower = uniquePower;
}
public int getHealth() {
return health;
}
public void setHealth(int health) {
this.health = health;
}
public int getDefense() {
return defense;
}
public void setDefense(int defense) {
this.defense = defense;
}
}