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 5f7357f  JUNEAU-197
5f7357f is described below

commit 5f7357f7f55ff372e5bf87691ad7d3379eddc852
Author: JamesBognar <[email protected]>
AuthorDate: Sun Mar 8 10:29:21 2020 -0400

    JUNEAU-197
    
    @BeanConfig(bpi) does not override @Bean(bpi)
---
 .../java/org/apache/juneau/jena/RdfBeanPropertyMeta.java  |  6 +++---
 .../src/main/java/org/apache/juneau/BeanPropertyMeta.java | 15 ++++++++-------
 .../java/org/apache/juneau/xml/XmlBeanPropertyMeta.java   |  4 ++--
 .../src/main/java/org/apache/juneau/xml/XmlUtils.java     |  8 +++++---
 4 files changed, 18 insertions(+), 15 deletions(-)

diff --git 
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfBeanPropertyMeta.java
 
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfBeanPropertyMeta.java
index 1cb14a4..4b77439 100644
--- 
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfBeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfBeanPropertyMeta.java
@@ -43,11 +43,11 @@ public class RdfBeanPropertyMeta extends 
ExtendedBeanPropertyMeta {
        public RdfBeanPropertyMeta(BeanPropertyMeta bpm, RdfMetaProvider mp) {
                super(bpm);
 
-               List<Rdf> rdfs = bpm.getAllAnnotations(Rdf.class);
-               List<RdfSchema> schemas = 
bpm.getAllAnnotations(RdfSchema.class);
+               List<Rdf> rdfs = bpm.getAllAnnotationsParentFirst(Rdf.class);
+               List<RdfSchema> schemas = 
bpm.getAllAnnotationsParentFirst(RdfSchema.class);
 
                for (Rdf rdf : rdfs) {
-                       if (collectionFormat == RdfCollectionFormat.DEFAULT)
+                       if (rdf.collectionFormat() != 
RdfCollectionFormat.DEFAULT)
                                collectionFormat = rdf.collectionFormat();
                        if (rdf.beanUri())
                                isBeanUri = true;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
index 0dfa3ec..4f9784b 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -1125,31 +1125,32 @@ public final class BeanPropertyMeta {
         *
         * @param <A> The class to find annotations for.
         * @param a The class to find annotations for.
-        * @return A list of annotations ordered in child-to-parent order.  
Never <jk>null</jk>.
+        * @return A list of annotations ordered in parent-to-child order.  
Never <jk>null</jk>.
         */
-       public <A extends Annotation> List<A> getAllAnnotations(Class<A> a) {
+       public <A extends Annotation> List<A> 
getAllAnnotationsParentFirst(Class<A> a) {
                List<A> l = new LinkedList<>();
                BeanContext bc = beanContext;
                if (a == null)
                        return l;
+               
getBeanMeta().getClassMeta().getInfo().appendAnnotationsParentFirst(l, a, bc);
+
                if (field != null) {
                        addIfNotNull(l, bc.getAnnotation(a, field));
-                       ClassInfo.of(field.getType()).appendAnnotations(l, a, 
bc);
+                       
ClassInfo.of(field.getType()).appendAnnotationsParentFirst(l, a, bc);
                }
                if (getter != null) {
                        addIfNotNull(l, bc.getAnnotation(a, getter));
-                       
ClassInfo.of(getter.getReturnType()).appendAnnotations(l, a, bc);
+                       
ClassInfo.of(getter.getReturnType()).appendAnnotationsParentFirst(l, a, bc);
                }
                if (setter != null) {
                        addIfNotNull(l, bc.getAnnotation(a, setter));
-                       
ClassInfo.of(setter.getReturnType()).appendAnnotations(l, a, bc);
+                       
ClassInfo.of(setter.getReturnType()).appendAnnotationsParentFirst(l, a, bc);
                }
                if (extraKeys != null) {
                        addIfNotNull(l, bc.getAnnotation(a, extraKeys));
-                       
ClassInfo.of(extraKeys.getReturnType()).appendAnnotations(l, a, bc);
+                       
ClassInfo.of(extraKeys.getReturnType()).appendAnnotationsParentFirst(l, a, bc);
                }
 
-               getBeanMeta().getClassMeta().getInfo().appendAnnotations(l, a, 
bc);
                return l;
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
index 66a1740..28fe780 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
@@ -104,8 +104,8 @@ public class XmlBeanPropertyMeta extends 
ExtendedBeanPropertyMeta {
                ClassMeta<?> cmBean = bpm.getBeanMeta().getClassMeta();
                String name = bpm.getName();
 
-               List<Xml> xmls = bpm.getAllAnnotations(Xml.class);
-               List<XmlSchema> schemas = 
bpm.getAllAnnotations(XmlSchema.class);
+               List<Xml> xmls = bpm.getAllAnnotationsParentFirst(Xml.class);
+               List<XmlSchema> schemas = 
bpm.getAllAnnotationsParentFirst(XmlSchema.class);
                namespace = XmlUtils.findNamespace(xmls, schemas);
 
                if (xmlFormat == XmlFormat.DEFAULT)
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java
index 4aed29a..bb66f89 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java
@@ -482,7 +482,7 @@ public final class XmlUtils {
         * Find the namespace given a list of <ja>@Xml</ja> and 
<ja>@XmlSchema</ja> annotations.
         *
         * <p>
-        * The annotations should be a child-to-parent ordering of annotations 
found on a class or method.
+        * The annotations should be a parent-to-child ordering of annotations 
found on a class or method.
         *
         * @param xmls The list of <ja>@Xml</ja> annotations.
         * @param schemas The list of <ja>@XmlSchema</ja> annotations.
@@ -490,13 +490,15 @@ public final class XmlUtils {
         */
        public static Namespace findNamespace(List<Xml> xmls, List<XmlSchema> 
schemas) {
 
-               for (Xml xml : xmls) {
+               for (int i = xmls.size()-1; i >= 0; i--) {
+                       Xml xml = xmls.get(i);
                        Namespace ns = findNamespace(xml.prefix(), 
xml.namespace(), xmls, schemas);
                        if (ns != null)
                                return ns;
                }
 
-               for (XmlSchema schema : schemas) {
+               for (int i = schemas.size()-1; i >= 0; i--) {
+                       XmlSchema schema = schemas.get(i);
                        Namespace ns = findNamespace(schema.prefix(), 
schema.namespace(), null, schemas);
                        if (ns != null)
                                return ns;

Reply via email to