This commit is contained in:
zhouhao
2022-01-25 11:03:07 +08:00
parent 4969a3981a
commit 0f65031aea
3 changed files with 26 additions and 4 deletions

View File

@@ -20,18 +20,22 @@
<artifactId>javassist</artifactId>
<version>3.28.0-GA</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.hswebframework</groupId>
<artifactId>hsweb-utils</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
@@ -106,5 +110,16 @@
<artifactId>reactor-extra</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<artifactId>jctools-core</artifactId>
<groupId>org.jctools</groupId>
<version>2.1.2</version>
</dependency>
</dependencies>
</project>

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.type.*;
import com.fasterxml.jackson.databind.util.ArrayBuilders;
import com.fasterxml.jackson.databind.util.LRUMap;
import com.fasterxml.jackson.databind.util.LookupCache;
import org.hswebframework.web.api.crud.entity.EntityFactory;
public class CustomTypeFactory extends TypeFactory {
@@ -11,18 +12,18 @@ public class CustomTypeFactory extends TypeFactory {
private EntityFactory entityFactory;
public CustomTypeFactory(EntityFactory factory) {
super(new LRUMap<>(64, 1024));
super((LookupCache)new LRUMap<>(64, 1024));
this.entityFactory = factory;
}
protected CustomTypeFactory(LRUMap<Object, JavaType> typeCache, TypeParser p,
protected CustomTypeFactory(LookupCache<Object, JavaType> typeCache, TypeParser p,
TypeModifier[] mods, ClassLoader classLoader) {
super(typeCache, p, mods, classLoader);
}
@Override
public TypeFactory withCache(LRUMap<Object, JavaType> cache) {
public TypeFactory withCache(LookupCache<Object, JavaType> cache) {
return new CustomTypeFactory(cache, _parser, _modifiers, _classLoader);
}
@@ -33,7 +34,7 @@ public class CustomTypeFactory extends TypeFactory {
@Override
public TypeFactory withModifier(TypeModifier mod) {
LRUMap<Object, JavaType> typeCache = _typeCache;
LookupCache<Object, JavaType> typeCache = _typeCache;
TypeModifier[] mods;
if (mod == null) { // mostly for unit tests
mods = null;

View File

@@ -34,6 +34,12 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-commons-crud</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>