Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion hsweb-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@
<name>${project.artifactId}</name>
<description>核心包</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.42</version>
</path>
<path>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.37</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>

<dependency>
Expand Down Expand Up @@ -168,11 +191,23 @@
<artifactId>hsweb-easy-orm-core</artifactId>
</dependency>

<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.8</version>
</dependency>

<dependency>
<groupId>io.micrometer</groupId>
<artifactId>context-propagation</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.37</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.hswebframework.web.bean;

import org.hswebframework.web.bean.accessor.AsmBeanAccessor;

final class AsmAccessorFastBeanCopierBackend extends AccessorFastBeanCopierBackend {

AsmAccessorFastBeanCopierBackend() {
super(new AsmBeanAccessor());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ClassDescription {
private final Class<?> type;

private final boolean collectionType;
private final boolean mapType;
private final boolean arrayType;
private final boolean enumType;
private final boolean enumDict;
Expand All @@ -23,24 +24,21 @@ public class ClassDescription {

public ClassDescription(Class<?> type) {
this.type = type;

collectionType = Collection.class.isAssignableFrom(type);
enumDict = EnumDict.class.isAssignableFrom(type);
arrayType = type.isArray();
enumType = type.isEnum();

number = Number.class.isAssignableFrom(type);
this.collectionType = Collection.class.isAssignableFrom(type);
this.mapType = Map.class.isAssignableFrom(type);
this.enumDict = EnumDict.class.isAssignableFrom(type);
this.arrayType = type.isArray();
this.enumType = type.isEnum();
this.number = Number.class.isAssignableFrom(type);
if (enumType) {
enums = type.getEnumConstants();
this.enums = type.getEnumConstants();
} else {
enums = null;
this.enums = null;
}
Map<String, Field> f = new HashMap<>();
ReflectionUtils.doWithFields(type, field -> {
f.put(field.getName(), field);
});
fields = Collections.unmodifiableMap(f);
fieldSize = fields.size();
Map<String, Field> fields = new HashMap<>();
ReflectionUtils.doWithFields(type, field -> fields.put(field.getName(), field));
this.fields = Collections.unmodifiableMap(fields);
this.fieldSize = this.fields.size();
}

}
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
package org.hswebframework.web.bean;


import org.hibernate.validator.internal.util.ConcurrentReferenceHashMap;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ClassDescriptions {

private static final Map<Class<?>, ClassDescription> CACHE = new ConcurrentHashMap<>();
private static final Map<Class<?>, ClassDescription> CACHE = new ConcurrentReferenceHashMap<>();

private static final Map<Class<?>, ClassDescription> CACHE0 = new ConcurrentHashMap<>();

private static final ClassLoader owner = ClassDescriptions.class.getClassLoader();

public static ClassDescription getDescription(Class<?> type) {
if (type.getClassLoader() == owner) {
return CACHE0.computeIfAbsent(type, ClassDescription::new);
}
return CACHE.computeIfAbsent(type, ClassDescription::new);
}

Expand Down
Loading
Loading