Skip to content

Commit

Permalink
Merge branch '2.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 4, 2023
2 parents 9e86154 + f1a3acb commit e14f857
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,36 @@ public String[] findEnumValues(MapperConfig<?> config,
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<String, String> enumToPropertyMap = new LinkedHashMap<String, String>();
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,36 @@ public String[] findEnumValues(MapperConfig<?> config,
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<String, String> enumToPropertyMap = new LinkedHashMap<String, String>();
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
Expand Down

0 comments on commit e14f857

Please sign in to comment.