You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2021/02/23 14:00:14 UTC

[juneau] branch master updated: Assertion.assertNotNull methods should be generic.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 786bf27  Assertion.assertNotNull methods should be generic.
786bf27 is described below

commit 786bf272666dac7afb8b1c941f1c54f3ae9098b3
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Tue Feb 23 08:59:59 2021 -0500

    Assertion.assertNotNull methods should be generic.
---
 TODO.txt                                                    | 13 +------------
 .../main/java/org/apache/juneau/assertions/Assertion.java   |  4 ++--
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/TODO.txt b/TODO.txt
index 1f4543a..5051df9 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,13 +1,5 @@
-RestCall.exception(...) should accumulate exceptions, not just one.
-Replace RestInfoProvider with Swagger.
-xxx Rework RestCallLogger.
-xxx @Rest(path) should allow you to match against file name (e.g. "favicon.ico")
 Replace @Rest(paths) with just @Rest(path)
-Auto-injection into REST interfaces (via providers?)
-ClassInfo improvements to getMethod (e.g. getMethodExact vs getMethod).
-Re-add @PathRemainder annotation.
-xxx Replace RestResourceResolver with ObjectFactory (or something already predefined?).
-xxx Remove @Rest(properties) and all that stuff.
+ClassInfo improvements to getMethod (e.g. getMethodExact vs getMethod).Re-add @PathRemainder annotation.
 Add a createConfig() method on RestContext.
 Thrown NotFound causes - javax.servlet.ServletException: Invalid method response: 200
 
@@ -17,8 +9,5 @@ Replace @Bean(findFluentSetters) with @FluentSetters.
 Remove @BeanIgnore annotations from classes.
 HttpResponse should use list of Headers and have a headers(Header...) method.
 HttpResponse should allow you to set code.
-Assertion.assertNotNull methods should be generic?
 HttpException subclasses can set status, but does it use code?
 HttpException should use list of Headers and have a headers(Header...) method.
-Add Named bean support by looking for @Named annotations.
-Rename BeanFactory to BeanStore.
\ No newline at end of file
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/Assertion.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/Assertion.java
index ae19473..f05aeb1 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/Assertion.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/Assertion.java
@@ -149,7 +149,7 @@ public class Assertion {
 	 * @param args The message arguments.
 	 * @return The value.
 	 */
-	protected Object assertNotNull(Object value, String msg, Object...args) {
+	protected <T> T assertNotNull(T value, String msg, Object...args) {
 		if (value == null)
 			throw new BasicAssertionError(format(msg, args));
 		return value;
@@ -162,7 +162,7 @@ public class Assertion {
 	 * @param value The value to check.
 	 * @return The value.
 	 */
-	protected Object assertNotNull(String parameter, Object value) {
+	protected <T> T assertNotNull(String parameter, T value) {
 		return assertNotNull(value, "Parameter ''{0}'' cannot be null.", parameter);
 	}