bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject [08/50] bval git commit: TCK: pick up constraints on 'inherited' fields
Date Tue, 16 Oct 2018 17:35:09 GMT
TCK: pick up constraints on 'inherited' fields


Project: http://git-wip-us.apache.org/repos/asf/bval/repo
Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/d34b59b1
Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/d34b59b1
Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/d34b59b1

Branch: refs/heads/master
Commit: d34b59b1a5b38447bca7941d5bfe1555cc2b0ae2
Parents: 1b4db6d
Author: Matt Benson <mbenson@apache.org>
Authored: Thu Apr 5 12:17:45 2018 -0500
Committer: Matt Benson <mbenson@apache.org>
Committed: Tue Oct 16 12:28:20 2018 -0500

----------------------------------------------------------------------
 .../apache/bval/jsr/metadata/HierarchyBuilder.java | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/d34b59b1/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/HierarchyBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/HierarchyBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/HierarchyBuilder.java
index 5fe228c..b449a6b 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/HierarchyBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/HierarchyBuilder.java
@@ -95,7 +95,19 @@ public class HierarchyBuilder extends CompositeBuilder {
 
         @Override
         public Map<String, MetadataBuilder.ForContainer<Field>> getFields(Meta<Class<T>>
meta) {
-            return delegate.getFields(hierarchyElement);
+            final Map<String, MetadataBuilder.ForContainer<Field>> fields = delegate.getFields(hierarchyElement);
+
+            if (fields.isEmpty()) {
+                return fields;
+            }
+            final Map<String, MetadataBuilder.ForContainer<Field>> result = new
LinkedHashMap<>();
+
+            fields.forEach((k, v) -> {
+                final Field fld = Reflection.getDeclaredField(hierarchyElement.getHost(),
k);
+                Exceptions.raiseIf(fld == null, IllegalStateException::new, "delegate builder
specified unknown field");
+                result.put(k, new ContainerDelegate<Field>(v, new Meta.ForField(fld)));
+            });
+            return result;
         }
 
         @Override
@@ -113,6 +125,9 @@ public class HierarchyBuilder extends CompositeBuilder {
         @Override
         public Map<String, MetadataBuilder.ForContainer<Method>> getGetters(Meta<Class<T>>
meta) {
             final Map<String, MetadataBuilder.ForContainer<Method>> getters =
delegate.getGetters(hierarchyElement);
+            if (getters.isEmpty()) {
+                return getters;
+            }
             final Map<String, MetadataBuilder.ForContainer<Method>> result =
new LinkedHashMap<>();
 
             getters.forEach((k, v) -> {


Mime
View raw message