From cfcfd1f546daaba120ae1321f7c1e2a05d7eaa28 Mon Sep 17 00:00:00 2001 From: joohyukkim Date: Thu, 22 Jun 2023 08:17:31 +0900 Subject: [PATCH 1/3] Add new findEnumValues method --- .../JakartaXmlBindAnnotationIntrospector.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/jakarta-xmlbind/src/main/java/com/fasterxml/jackson/module/jakarta/xmlbind/JakartaXmlBindAnnotationIntrospector.java b/jakarta-xmlbind/src/main/java/com/fasterxml/jackson/module/jakarta/xmlbind/JakartaXmlBindAnnotationIntrospector.java index 347e4893..197564dc 100644 --- a/jakarta-xmlbind/src/main/java/com/fasterxml/jackson/module/jakarta/xmlbind/JakartaXmlBindAnnotationIntrospector.java +++ b/jakarta-xmlbind/src/main/java/com/fasterxml/jackson/module/jakarta/xmlbind/JakartaXmlBindAnnotationIntrospector.java @@ -951,6 +951,36 @@ public String[] findEnumValues(Class enumType, Enum[] enumValues, String[] return names; } + /** + * @see JacksonAnnotationIntrospector#findEnumValues(MapperConfig, AnnotatedClass, Enum[], String[]) + * @since 2.16 + */ + @Override + public String[] findEnumValues(MapperConfig config, AnnotatedClass annotatedClass, + Enum[] enumValues, String[] names) + { + Map enumToPropertyMap = new LinkedHashMap(); + for (AnnotatedField field : annotatedClass.fields()) { + XmlEnumValue property = field.getAnnotation(XmlEnumValue.class); + if (property != null) { + String propValue = property.value(); + if (propValue != null && !propValue.isEmpty()) { + enumToPropertyMap.put(field.getName(), propValue); + } + } + } + + // and then stitch them together if and as necessary + for (int i = 0, end = enumValues.length; i < end; ++i) { + String defName = enumValues[i].name(); + String explValue = enumToPropertyMap.get(defName); + if (explValue != null) { + names[i] = explValue; + } + } + return names; + } + /* /********************************************************************** /* Deserialization: general annotations From ccd06342c217599c379b932dcec4672a5819809f Mon Sep 17 00:00:00 2001 From: joohyukkim Date: Thu, 22 Jun 2023 08:23:04 +0900 Subject: [PATCH 2/3] Update JaxbAnnotationIntrospector.java --- .../jaxb/JaxbAnnotationIntrospector.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/jaxb/src/main/java/com/fasterxml/jackson/module/jaxb/JaxbAnnotationIntrospector.java b/jaxb/src/main/java/com/fasterxml/jackson/module/jaxb/JaxbAnnotationIntrospector.java index 5744d900..9da2cfa2 100644 --- a/jaxb/src/main/java/com/fasterxml/jackson/module/jaxb/JaxbAnnotationIntrospector.java +++ b/jaxb/src/main/java/com/fasterxml/jackson/module/jaxb/JaxbAnnotationIntrospector.java @@ -969,6 +969,36 @@ public String[] findEnumValues(Class enumType, Enum[] enumValues, String[] return names; } + /** + * @see JacksonAnnotationIntrospector#findEnumValues(MapperConfig, AnnotatedClass, Enum[], String[]) + * @since 2.16 + */ + @Override + public String[] findEnumValues(MapperConfig config, AnnotatedClass annotatedClass, + Enum[] enumValues, String[] names) + { + Map enumToPropertyMap = new LinkedHashMap(); + for (AnnotatedField field : annotatedClass.fields()) { + XmlEnumValue property = field.getAnnotation(XmlEnumValue.class); + if (property != null) { + String propValue = property.value(); + if (propValue != null && !propValue.isEmpty()) { + enumToPropertyMap.put(field.getName(), propValue); + } + } + } + + // and then stitch them together if and as necessary + for (int i = 0, end = enumValues.length; i < end; ++i) { + String defName = enumValues[i].name(); + String explValue = enumToPropertyMap.get(defName); + if (explValue != null) { + names[i] = explValue; + } + } + return names; + } + /* /********************************************************** /* Deserialization: general annotations From 66a725124d5475aeccbc52dd40abf44f0991c727 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 3 Jul 2023 21:06:27 -0700 Subject: [PATCH 3/3] Udpate Maven wrapper version --- .mvn/wrapper/maven-wrapper.properties | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 642d572c..5366408e 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,18 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar