This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 996b6007f [SCB-2646] fix code format (#3248)
996b6007f is described below
commit 996b6007f32771ede9375bdca92714c8a5602fa4
Author: liubao68 <[email protected]>
AuthorDate: Sun Jul 31 14:54:56 2022 +0800
[SCB-2646] fix code format (#3248)
---
.../servicecomb/config/priority/ConfigObjectFactory.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
index 7bec69d76..16f4a2cb8 100644
---
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
+++
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
@@ -16,8 +16,6 @@
*/
package org.apache.servicecomb.config.priority;
-import static
org.apache.servicecomb.foundation.common.utils.LambdaMetafactoryUtils.createObjectSetter;
-
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
@@ -47,9 +45,13 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
@Component
public class ConfigObjectFactory {
private final PriorityPropertyFactory propertyFactory;
+
private static final Map<Class<?>, JavaType> classCache = new
ConcurrentHashMapEx<>();
+
private static final Map<JavaType, BeanDescription> javaTypeCache = new
ConcurrentHashMapEx<>();
+
private static final Map<BeanPropertyDefinition, Setter<Object, Object>>
beanDescriptionCache = new ConcurrentHashMapEx<>();
+
public ConfigObjectFactory(PriorityPropertyFactory propertyFactory) {
this.propertyFactory = propertyFactory;
}
@@ -90,7 +92,7 @@ public class ConfigObjectFactory {
List<ConfigObjectProperty> properties = new ArrayList<>();
JavaType javaType = classCache.computeIfAbsent(instance.getClass(),
TypeFactory.defaultInstance()::constructType);
BeanDescription beanDescription = javaTypeCache.computeIfAbsent(javaType,
- JsonUtils.OBJ_MAPPER.getSerializationConfig()::introspect);
+ JsonUtils.OBJ_MAPPER.getSerializationConfig()::introspect);
for (BeanPropertyDefinition propertyDefinition :
beanDescription.findProperties()) {
if (propertyDefinition.getField() == null) {
continue;
@@ -101,7 +103,7 @@ public class ConfigObjectFactory {
}
Setter<Object, Object> setter =
beanDescriptionCache.computeIfAbsent(propertyDefinition,
- LambdaMetafactoryUtils::createObjectSetter);
+ LambdaMetafactoryUtils::createObjectSetter);
PriorityProperty<?> priorityProperty =
createPriorityProperty(propertyDefinition.getField().getAnnotated(),
prefix, parameters);
setter.set(instance, priorityProperty.getValue());
@@ -211,7 +213,7 @@ public class ConfigObjectFactory {
private String[] collectPropertyKeys(Field field, String prefix, Map<String,
Object> parameters) {
String propertyPrefix = prefix;
- String[] keys = new String[]{field.getName()};
+ String[] keys = new String[] {field.getName()};
InjectProperty injectProperty = field.getAnnotation(InjectProperty.class);
if (injectProperty != null) {