Skip to content

Commit 2a30d3c

Browse files
author
Suszyński Krzysztof
committed
Javadoc fixes
1 parent cbfc6cd commit 2a30d3c

File tree

3 files changed

+74
-86
lines changed

3 files changed

+74
-86
lines changed

src/main/java/pl/wavesoftware/eid/exceptions/Eid.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ public static String setRefFormat(String refFormat) {
162162
/**
163163
* Makes a log message from this EID object
164164
* <p>
165-
* <p>This method is for convenience of usage of EID in logging. You can use it like this:
166-
* <p>
165+
* This method is for convenience of usage of EID in logging. You can use it like this:
167166
* <pre>
168167
* log.debug(new Eid("20151025:202129").makeLogMessage("A request: %s", request));
169168
* </pre>

src/main/java/pl/wavesoftware/eid/exceptions/EidRuntimeException.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public EidRuntimeException(String eid, String ref) {
5454
}
5555

5656
/**
57-
* Constructs a new runtime exception with the specified cause, a exception Id and detail message of <tt>eid.toString() + " =>
58-
* " + (cause==null ? null : cause.toString())</tt>
59-
* (which typically contains the class and detail message of
60-
* <tt>cause</tt>). This constructor is useful for runtime exceptions that are little more than wrappers for other throwable.
57+
* Constructs a new runtime exception with the specified cause, a exception Id and detail message of
58+
* <code>eid.toString() + " =&gt; " + (cause==null ? null : cause.toString())</code> (which typically contains
59+
* the class and detail message of <code>cause</code>). This constructor is useful for runtime exceptions
60+
* that are little more than wrappers for other throwable.
6161
*
6262
* @param eid exception ID
63-
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt>
63+
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <code>null</code>
6464
* value is permitted, and indicates that the cause is nonexistent or unknown.)
6565
*/
6666
public EidRuntimeException(String eid, Throwable cause) {
@@ -72,7 +72,7 @@ public EidRuntimeException(String eid, Throwable cause) {
7272
*
7373
* @param eid exception ID
7474
* @param ref the ref code for Eid
75-
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt> value is
75+
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <code>null</code> value is
7676
* permitted, and indicates that the cause is nonexistent or unknown.)
7777
*/
7878
public EidRuntimeException(String eid, String ref, Throwable cause) {
@@ -92,10 +92,10 @@ public EidRuntimeException(Eid id) {
9292
/**
9393
* Constructs a new runtime exception with the specified Eid object and cause
9494
* <p>
95-
* The detail message is computed as <tt>String.format(Eid.getMessageFormat(), id.toString(), message(cause))</tt>
95+
* The detail message is computed as <code>String.format(Eid.getMessageFormat(), id.toString(), message(cause))</code>
9696
*
9797
* @param id exception ID
98-
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt> value is
98+
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <code>null</code> value is
9999
* permitted, and indicates that the cause is nonexistent or unknown.)
100100
*/
101101
public EidRuntimeException(Eid id, Throwable cause) {

src/main/java/pl/wavesoftware/eid/utils/EidPreconditions.java

Lines changed: 65 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -27,81 +27,72 @@
2727
import javax.annotation.Nullable;
2828

2929
/**
30-
* <strong>This class shouldn't be used in any public API or library.</strong> It is designed to be used for in-house development
31-
* of end user applications which will report Bugs in standardized error pages or post them to issue tracker.
32-
* <p/>
30+
* <p>
31+
* <strong>This class shouldn't be used in any public API or library.</strong> It is designed to be used for in-house
32+
* development of end user applications which will report Bugs in standardized error pages or post them to issue
33+
* tracker.
34+
* <p>
3335
* Static convenience methods that help a method or constructor check whether it was invoked correctly (whether its
34-
* <i>preconditions</i>
35-
* have been met). These methods generally accept a {@code boolean} expression which is expected to be {@code true} (or in the
36-
* case of {@code
37-
* checkNotNull}, an object reference which is expected to be non-null). When {@code false} (or {@code null}) is passed instead,
38-
* the {@code EidPreconditions} method throws an unchecked exception, which helps the calling method communicate to <i>its</i>
39-
* caller that
40-
* <i>that</i> caller has made a mistake.
41-
* <p/>
42-
* Each method accepts a EID String or {@link Eid} object, which is designed to ease of use and provide strict ID for given
43-
* Exception usage. This approach speed up development of large application and helps support teams to by giving the both static
44-
* and random ID for each possible unpredicted bug.
45-
* <p/>
36+
* <i>preconditions</i> have been met). These methods generally accept a {@code boolean} expression which is expected
37+
* to be {@code true} (or in the case of {@link #checkNotNull(Object, String)}, an object reference which is expected
38+
* to be non-null). When {@code false} (or {@code null}) is passed instead, the {@link EidPreconditions} method throws
39+
* an unchecked exception, which helps the calling method communicate to <i>its</i> caller <i>that</i> caller has made
40+
* a mistake.
41+
* <p>
42+
* Each method accepts a EID String or {@link Eid} object, which is designed to ease of use and provide strict ID for
43+
* given Exception usage. This approach speed up development of large application and helps support teams to by giving
44+
* the both static and random ID for each possible unpredicted bug.
45+
* <p>
4646
* This is best to use with tools and plugins like
4747
* <a href="http://plugins.netbeans.org/plugin/53137/exception-id-eid-generator">EidGenerator for Netbeans IDE</a>
48-
* <p/>
48+
* <p>
4949
* Example:
50-
* <pre> {@code
51-
*
52-
* /**
53-
* * Returns the positive square root of the given value.
54-
* *
55-
* * @throws EidIllegalArgumentException if the value is negative
56-
* *}{@code /
57-
* public static double sqrt(double value) {
58-
* EidPreconditions.checkArgument(value >= 0.0, "20150718:012333");
50+
* <pre>
51+
* &#47;**
52+
* * Returns the positive square root of the given value.
53+
* *
54+
* * &#64;throws EidIllegalArgumentException if the value is negative
55+
* *&#47;
56+
* public static double sqrt(double value) {
57+
* EidPreconditions.checkArgument(value &gt;= 0.0, "20150718:012333");
5958
* // calculate the square root
60-
* }
59+
* }
6160
*
62-
* void exampleBadCaller() {
61+
* void exampleBadCaller() {
6362
* double d = sqrt(-1.0);
64-
* }
65-
* }</pre>
66-
* <p/>
67-
* In this example, {@code checkArgument} throws an {@code EidIllegalArgumentException} to indicate that {@code exampleBadCaller}
68-
* made an error in <i>its</i> call to {@code sqrt}. Exception, when it will be printed will contain user given Eid and also
69-
* Randomly generated ID. Those fields can be displayed to user on error page on posted directly to issue tracker.
70-
* <p/>
63+
* }
64+
* </pre>
65+
* <p>
66+
* In this example, {@link #checkArgument(boolean, String)} throws an {@link EidIllegalArgumentException} to indicate
67+
* that {@code exampleBadCaller} made an error in <i>its</i> call to {@code sqrt}. Exception, when it will be printed
68+
* will contain user given Eid and also randomly generated ID. Those fields can be displayed to user on error page on
69+
* posted directly to issue tracker.
70+
* <p>
7171
* Example:
72-
* <p/>
7372
* <pre>
74-
*
75-
* {@code
76-
* // Main application class for ex.: http servlet
77-
* try {
78-
* performRequest(request, response);
79-
* } catch (EidRuntimeException ex) {
80-
* issuesTracker.put(ex);
81-
* throw ex;
82-
* }
83-
* }</pre>
84-
* <p/>
85-
* <p/>
73+
* // Main application class for ex.: http servlet
74+
* try {
75+
* performRequest(request, response);
76+
* } catch (EidRuntimeException ex) {
77+
* issuesTracker.put(ex);
78+
* throw ex;
79+
* }
80+
* </pre>
8681
* <h3>Functional try to execute blocks</h3>
87-
* <p/>
88-
* <p/>
8982
* Using functional blocks to handle operations, that are intended to operate properly, simplify the code and makes it more
9083
* readable. It's also good way to deal with untested, uncovered {@code catch} blocks. It's easy and gives developers nice way of
9184
* dealing with countless operations that suppose to work as intended.
92-
* <p/>
93-
* <p/>
85+
* <p>
9486
* Example:
95-
* <pre><code>
96-
*
97-
* InputStream is = EidPreconditions.tryToExecute({@code new UnsafeSupplier<InputStream>}() {
98-
* {@literal @}Override
99-
* public InputStream get() throws IOException {
100-
* return this.getClass().getClassLoader()
101-
* .getResourceAsStream("project.properties");
102-
* }
103-
* }, "20150718:121521");
104-
* </code></pre>
87+
* <pre>
88+
* InputStream is = EidPreconditions.tryToExecute(new UnsafeSupplier&lt;InputStream&gt;() {
89+
* &#64;Override
90+
* public InputStream get() throws IOException {
91+
* return this.getClass().getClassLoader()
92+
* .getResourceAsStream("project.properties");
93+
* }
94+
* }, "20150718:121521");
95+
* </pre>
10596
*
10697
* @author <a href="mailto:[email protected]">Krzysztof Suszynski</a>
10798
* @since 0.1.0 (idea imported from Guava Library and COI code)
@@ -450,18 +441,17 @@ public static void tryToExecute(final UnsafeProcedure procedure, final String ei
450441
/**
451442
* Tries to execute code in given unsafe supplier code block, and if exception is thrown, it will gets rethrown as a
452443
* {@link EidRuntimeException} with eid given as a argument. This is because this exception is threaded as a software bug!
453-
* <p/>
444+
* <p>
454445
* Example:
455-
* <pre><code>
456-
*
457-
* Document doc = EidPreconditions.tryToExecute({@code new UnsafeSupplier<Document>}() {
458-
* {@literal @}Override
446+
* <pre>
447+
* Document doc = EidPreconditions.tryToExecute(new UnsafeSupplier&lt;Document&gt;}() {
448+
* &#64;Override
459449
* public Document get() throws SAXException, IOException {
460-
* DocumentBuilder docBuilder = ...
461-
* return docBuilder.parse(new InputSource(reader));
450+
* DocumentBuilder docBuilder = ...
451+
* return docBuilder.parse(new InputSource(reader));
462452
* }
463453
* }, new Eid("20150718:121521"));
464-
* </code></pre>
454+
* </pre>
465455
*
466456
* @param <R> return type
467457
* @param supplier unsafe supplier code to be executed within a try-catch block
@@ -480,17 +470,16 @@ public static <R> R tryToExecute(final UnsafeSupplier<R> supplier, final Eid eid
480470
/**
481471
* Tries to execute code in given unsafe procedure code block, and if exception is thrown, it will gets rethrown as a
482472
* {@link EidRuntimeException} with eid given as a argument. This is because this exception is threaded as a software bug!
483-
* <p/>
473+
* <p>
484474
* Example:
485-
* <pre><code>
486-
*
487-
* EidPreconditions.tryToExecute({@code new UnsafeProcedure}() {
488-
* {@literal @}Override
475+
* <pre>
476+
* EidPreconditions.tryToExecute(new UnsafeProcedure() {
477+
* &#64;Override
489478
* public void execute() throws EJBException {
490-
* em.persist(user);
479+
* em.persist(user);
491480
* }
492481
* }, new Eid("20151117:184627"));
493-
* </code></pre>
482+
* </pre>
494483
*
495484
* @param procedure unsafe procedure code to be executed within a try-catch block
496485
* @param eid unique developer identifier from date for ex.: "20150716:123200"

0 commit comments

Comments
 (0)