Skip to content

Commit fc29916

Browse files
authored
reduce amount of javadoc warnings (#560)
improve code quality by reducing amount of javadoc warnings
1 parent b542dc2 commit fc29916

11 files changed

+458
-6
lines changed

core/src/main/java/pl/project13/core/AheadBehind.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,64 @@
1919

2020
import java.util.Objects;
2121

22+
/**
23+
* A local git repository can either be "ahead", or "behind" in the number of commits
24+
* relative to the remote repository. This class tracks the amount of commits the local git repository
25+
* is "behind", or "ahead" relative to it's remote.
26+
*/
2227
public class AheadBehind {
2328

29+
/**
30+
* Indication that we could not find a remote repository to calculate a "behind", or "ahead" relation.
31+
*/
2432
public static final AheadBehind NO_REMOTE = AheadBehind.of("NO_REMOTE", "NO_REMOTE");
2533

2634
private final String ahead;
2735

2836
private final String behind;
2937

38+
/**
39+
* Constructor for a "AheadBehind"-object.
40+
* @param ahead Number of commits the local repository is "ahead" in relation to it's remote.
41+
* @param behind Number of commits the local repository is "behind" in relation to it's remote.
42+
*/
3043
private AheadBehind(String ahead, String behind) {
3144
this.ahead = ahead;
3245
this.behind = behind;
3346
}
3447

48+
/**
49+
* Constructor for a "AheadBehind"-object.
50+
* @param ahead Number of commits the local repository is "ahead" in relation to it's remote.
51+
* @param behind Number of commits the local repository is "behind" in relation to it's remote.
52+
*
53+
* @return a "AheadBehind"-object.
54+
*/
3555
public static AheadBehind of(int ahead, int behind) {
3656
return new AheadBehind(String.valueOf(ahead), String.valueOf(behind));
3757
}
3858

59+
/**
60+
* Constructor for a "AheadBehind"-object.
61+
* @param ahead Number of commits the local repository is "ahead" in relation to it's remote.
62+
* @param behind Number of commits the local repository is "behind" in relation to it's remote.
63+
*
64+
* @return a "AheadBehind"-object.
65+
*/
3966
public static AheadBehind of(String ahead, String behind) {
4067
return new AheadBehind(ahead, behind);
4168
}
4269

70+
/**
71+
* @return Number of commits the local repository is "ahead" in relation to it's remote.
72+
*/
4373
public String ahead() {
4474
return ahead;
4575
}
4676

77+
/**
78+
* @return Number of commits the local repository is "behind" in relation to it's remote.
79+
*/
4780
public String behind() {
4881
return behind;
4982
}

core/src/main/java/pl/project13/core/CannotReadFileException.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@
1717

1818
package pl.project13.core;
1919

20+
/**
21+
* An exception to indicate that a required file could not be found.
22+
*/
2023
public class CannotReadFileException extends Exception {
2124
private static final long serialVersionUID = -9080356227094128542L;
2225

26+
/**
27+
* Constructs a new exception with the specified cause
28+
*
29+
* @param cause the cause (which is saved for later retrieval by the
30+
* {@link Exception#getCause()} method). (A {@code null} value is
31+
* permitted, and indicates that the cause is nonexistent or
32+
* unknown.)
33+
*/
2334
public CannotReadFileException(Throwable cause) {
2435
super(cause);
2536
}

core/src/main/java/pl/project13/core/CommitIdGenerationMode.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@
1717

1818
package pl.project13.core;
1919

20+
/**
21+
* An enum to indicate how the {@code git.commit.id} property should be generated.
22+
* See https://github.com/ktoso/maven-git-commit-id-plugin/issues/211 for further details.
23+
*/
2024
public enum CommitIdGenerationMode {
25+
/**
26+
* Indicator to generate a {@code git.commit.id.full} property
27+
*/
2128
FULL,
29+
/**
30+
* Indicator to generate a {@code git.commit.id} property (default)
31+
*/
2232
FLAT
2333
}

core/src/main/java/pl/project13/core/GitCommitIdExecutionException.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,63 @@
2424
public class GitCommitIdExecutionException extends Exception {
2525
private static final long serialVersionUID = 4608506012492555968L;
2626

27+
/**
28+
* Constructs a new exception
29+
*/
2730
public GitCommitIdExecutionException() {
2831
super();
2932
}
3033

34+
/**
35+
* Constructs a new exception with the specified detail message.
36+
*
37+
* @param message the detail message. The detail message is saved for
38+
* later retrieval by the {@link Exception#getMessage()} method.
39+
*/
3140
public GitCommitIdExecutionException(String message) {
3241
super(message);
3342
}
3443

44+
/**
45+
* Constructs a new exception with the specified detail message and
46+
* cause.
47+
*
48+
* @param message the detail message (which is saved for later retrieval
49+
* by the {@link Exception#getMessage()} method).
50+
* @param cause the cause (which is saved for later retrieval by the
51+
* {@link Exception#getCause()} method). (A {@code null} value is
52+
* permitted, and indicates that the cause is nonexistent or
53+
* unknown.)
54+
*/
3555
public GitCommitIdExecutionException(String message, Throwable cause) {
3656
super(message, cause);
3757
}
3858

59+
/**
60+
* Constructs a new exception with the specified cause
61+
*
62+
* @param cause the cause (which is saved for later retrieval by the
63+
* {@link Exception#getCause()} method). (A {@code null} value is
64+
* permitted, and indicates that the cause is nonexistent or
65+
* unknown.)
66+
*/
3967
public GitCommitIdExecutionException(Throwable cause) {
4068
super(cause);
4169
}
4270

71+
/**
72+
* Constructs a new exception with the specified detail message,
73+
* cause, suppression enabled or disabled, and writable stack
74+
* trace enabled or disabled.
75+
*
76+
* @param message the detail message.
77+
* @param cause the cause. (A {@code null} value is permitted,
78+
* and indicates that the cause is nonexistent or unknown.)
79+
* @param enableSuppression whether or not suppression is enabled
80+
* or disabled
81+
* @param writableStackTrace whether or not the stack trace should
82+
* be writable
83+
*/
4384
public GitCommitIdExecutionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
4485
super(message, cause, enableSuppression, writableStackTrace);
4586
}

core/src/main/java/pl/project13/core/GitCommitPropertyConstant.java

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,132 @@
1717

1818
package pl.project13.core;
1919

20+
/**
21+
* A class that represents all properties that may be generated by the plugin and exposed to maven.
22+
*/
2023
public class GitCommitPropertyConstant {
21-
// these properties will be exposed to maven
24+
/**
25+
* Represents the current branch name. Falls back to commit-id for detached HEAD.
26+
*/
2227
public static final String BRANCH = "branch";
28+
/**
29+
* Represents the count of commits that your local branch is ahead in perspective to the remote branch
30+
* (usually the case when your local branch has committed changes that are not pushed yet to the remote branch).
31+
*/
2332
public static final String LOCAL_BRANCH_AHEAD = "local.branch.ahead";
33+
/**
34+
* Represents the count of commits that your local branch is behind in perspective to the remote branch
35+
* (usually the case when there are commits in the remote branch that are not yet integrated into your local branch).
36+
*/
2437
public static final String LOCAL_BRANCH_BEHIND = "local.branch.behind";
38+
/**
39+
* A working tree is said to be "dirty" if it contains modifications
40+
* which have not been committed to the current branch.
41+
*/
2542
public static final String DIRTY = "dirty";
26-
// only one of the following two will be exposed, depending on the commitIdGenerationMode
43+
/**
44+
* Represents the commit’s SHA-1 hash. Note this is exchangeable with the git.commit.id.full property
45+
* and might not be exposed. See {@code commitIdGenerationMode}.
46+
*/
2747
public static final String COMMIT_ID_FLAT = "commit.id";
48+
/**
49+
* Represents the commit’s SHA-1 hash. Note this is exchangeable with the git.commit.id property
50+
* and might not be exposed. See {@code commitIdGenerationMode}.
51+
*/
2852
public static final String COMMIT_ID_FULL = "commit.id.full";
53+
/**
54+
* Represents the abbreviated (shorten version) commit hash.
55+
*/
2956
public static final String COMMIT_ID_ABBREV = "commit.id.abbrev";
57+
/**
58+
* Represents an object a human readable name based on a the commit (provides git describe for the given commit).
59+
*/
3060
public static final String COMMIT_DESCRIBE = "commit.id.describe";
61+
/**
62+
* Represents the same value as git.commit.id.describe,
63+
* just with the git hash part removed (the g2414721 part from git describe).
64+
*/
3165
public static final String COMMIT_SHORT_DESCRIBE = "commit.id.describe-short";
66+
/**
67+
* Represents the git user name that is configured where the properties have been generated.
68+
*/
3269
public static final String BUILD_AUTHOR_NAME = "build.user.name";
70+
/**
71+
* Represents the git user eMail that is configured where the properties have been generated.
72+
*/
3373
public static final String BUILD_AUTHOR_EMAIL = "build.user.email";
74+
/**
75+
* Represents the (formatted) timestamp when the last build was executed.
76+
* If written to the git.properties file represents the latest build time when that file was written / updated.
77+
*/
3478
public static final String BUILD_TIME = "build.time";
79+
/**
80+
* Represents the project version of the current maven project.
81+
*/
3582
public static final String BUILD_VERSION = "build.version";
83+
/**
84+
* Represents the hostname where the properties have been generated.
85+
*/
3686
public static final String BUILD_HOST = "build.host";
87+
/**
88+
* The git.build.number* variables are available on some hosted CIs and can be used to identify the
89+
* "number" of the build. This represents a project specific build number.
90+
*/
3791
public static final String BUILD_NUMBER = "build.number";
92+
/**
93+
* The git.build.number* variables are available on some hosted CIs and can be used to identify the
94+
* "number" of the build. This represents a system wide unique build number.
95+
*/
3896
public static final String BUILD_NUMBER_UNIQUE = "build.number.unique";
97+
/**
98+
* Represents the user name of the user who performed the commit.
99+
*/
39100
public static final String COMMIT_AUTHOR_NAME = "commit.user.name";
101+
/**
102+
* Represents the user eMail of the user who performed the commit.
103+
*/
40104
public static final String COMMIT_AUTHOR_EMAIL = "commit.user.email";
105+
/**
106+
* Represents the raw body (unwrapped subject and body) of the commit message.
107+
*/
41108
public static final String COMMIT_MESSAGE_FULL = "commit.message.full";
109+
/**
110+
* Represents the subject of the commit message - may not be suitable for filenames.
111+
*/
42112
public static final String COMMIT_MESSAGE_SHORT = "commit.message.short";
113+
/**
114+
* Represents the (formatted) time stamp when the commit has been performed.
115+
*/
43116
public static final String COMMIT_TIME = "commit.time";
117+
/**
118+
* Represents the (formatted) time stamp when the commit has been originally performed.
119+
*/
44120
public static final String COMMIT_AUTHOR_TIME = "commit.author.time";
121+
/**
122+
* Represents the (formatted) time stamp when the commit has been performed.
123+
*/
45124
public static final String COMMIT_COMMITTER_TIME = "commit.committer.time";
125+
/**
126+
* Represents the URL of the remote repository for the current git project.
127+
*/
46128
public static final String REMOTE_ORIGIN_URL = "remote.origin.url";
129+
/**
130+
* Represents a list of tags which contain the specified commit.
131+
*/
47132
public static final String TAGS = "tags";
133+
/**
134+
* Represents the name of the closest available tag.
135+
* The closest tag may depend on your git describe config that may or may not take lightweight tags into consideration.
136+
*/
48137
public static final String CLOSEST_TAG_NAME = "closest.tag.name";
138+
/**
139+
* Represents the number of commits to the closest available tag.
140+
* The closest tag may depend on your git describe config that may or may not take lightweight tags into consideration.
141+
*/
49142
public static final String CLOSEST_TAG_COMMIT_COUNT = "closest.tag.commit.count";
143+
/**
144+
* Represents the total count of all commits in the current repository.
145+
*/
50146
public static final String TOTAL_COMMIT_COUNT = "total.commit.count";
51147

52148
}

0 commit comments

Comments
 (0)