Commit 198346fc0d5eabcd1d988a592a814c0aaf256650
1 parent
1ca3606b
Exists in
master
Adição de javadoc na classe br.gov.frameworkdemoiselle.util.Exceptions
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Exceptions.java
@@ -38,15 +38,39 @@ package br.gov.frameworkdemoiselle.util; | @@ -38,15 +38,39 @@ package br.gov.frameworkdemoiselle.util; | ||
38 | 38 | ||
39 | import br.gov.frameworkdemoiselle.exception.ApplicationException; | 39 | import br.gov.frameworkdemoiselle.exception.ApplicationException; |
40 | 40 | ||
41 | +/** | ||
42 | + *Class that offer tow methods that can help with manipulation of throwable exceptions. | ||
43 | + * | ||
44 | + * @author SERPRO | ||
45 | + */ | ||
41 | public final class Exceptions { | 46 | public final class Exceptions { |
42 | 47 | ||
48 | + /** | ||
49 | + * Constructor without parameters. | ||
50 | + */ | ||
43 | private Exceptions() { | 51 | private Exceptions() { |
44 | } | 52 | } |
45 | 53 | ||
54 | + /** | ||
55 | + * Informs if a Throwable class is annotated with @ApplicationException or not. | ||
56 | + * | ||
57 | + * @param throwable | ||
58 | + * a throwable object. | ||
59 | + * | ||
60 | + * @return a boolean, true if thowable is annotated with @ApplicationException, and false otherwise. | ||
61 | + */ | ||
46 | public static boolean isApplicationException(final Throwable throwable) { | 62 | public static boolean isApplicationException(final Throwable throwable) { |
47 | return throwable != null && throwable.getClass().isAnnotationPresent(ApplicationException.class); | 63 | return throwable != null && throwable.getClass().isAnnotationPresent(ApplicationException.class); |
48 | } | 64 | } |
49 | 65 | ||
66 | + /** | ||
67 | + * Receives as parameter any kind of Throwable objects, and throws a RuntimeException instead. | ||
68 | + * | ||
69 | + * @param throwable | ||
70 | + * a throwable object. | ||
71 | + * | ||
72 | + * @throws RuntimeException throws this kind of exception every time that is called. | ||
73 | + */ | ||
50 | public static void handleToRuntimeException(final Throwable throwable) throws RuntimeException { | 74 | public static void handleToRuntimeException(final Throwable throwable) throws RuntimeException { |
51 | if (throwable instanceof RuntimeException) { | 75 | if (throwable instanceof RuntimeException) { |
52 | throw (RuntimeException) throwable; | 76 | throw (RuntimeException) throwable; |