You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/05/30 09:01:11 UTC

[isis] branch master updated: ISIS-1956: polishing _Reflect (Internal API)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 53a8ff7  ISIS-1956: polishing _Reflect (Internal API)
53a8ff7 is described below

commit 53a8ff76c48dd100c1b1391cbb3deab43e0c1735
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed May 30 11:00:57 2018 +0200

    ISIS-1956: polishing _Reflect (Internal API)
---
 .../java/org/apache/isis/commons/internal/reflection/_Reflect.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/reflection/_Reflect.java b/core/commons/src/main/java/org/apache/isis/commons/internal/reflection/_Reflect.java
index 6eb928d..2ad189e 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/reflection/_Reflect.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/reflection/_Reflect.java
@@ -21,6 +21,7 @@ package org.apache.isis.commons.internal.reflection;
 
 import static org.apache.isis.commons.internal.base._NullSafe.stream;
 import static org.apache.isis.commons.internal.base._With.mapIfPresentElse;
+import static org.apache.isis.commons.internal.base._With.requires;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Member;
@@ -57,6 +58,7 @@ public final class _Reflect {
 	 * @return
 	 */
 	public static <T extends Member> Predicate<T> withName(final String memberName) {
+		requires(memberName, "memberName");
 		return m -> m != null && memberName.equals(m.getName());
 	}
 
@@ -66,6 +68,7 @@ public final class _Reflect {
 	 * @return
 	 */
 	public static <T extends Member> Predicate<T> withPrefix(final String prefix) {
+		requires(prefix, "prefix");
 		return m -> m != null && m.getName().startsWith(prefix);
 	}
 
@@ -84,6 +87,7 @@ public final class _Reflect {
 	 * @return
 	 */
 	public static <T> Predicate<Field> withTypeAssignableTo(final Class<T> type) {
+		requires(type, "type");
 		return (Field f) -> f != null && type.isAssignableFrom(f.getType());
 	}
 
@@ -136,7 +140,7 @@ public final class _Reflect {
 
 	/**
 	 * Stream all types of given {@code type}, up the super class hierarchy starting with self
-	 * @param type
+	 * @param type (nullable)
 	 * @return
 	 */
 	public static Stream<Class<?>> streamTypeHierarchy(@Nullable Class<?> type) {

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.