Skip to content

Commit

Permalink
✨ 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
li-xunhuan committed Jan 21, 2025
1 parent 9b93a9c commit 63efafa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public static MicaBeanCopier create(Class source, Class target, boolean useConve
// 利用 ConcurrentMap 缓存 提高性能,接近 直接 get set
return CollectionUtil.computeIfAbsent(BEAN_COPIER_MAP, copierKey, key -> {
Generator gen = new Generator();
gen.setSource(key.getSource());
gen.setTarget(key.getTarget());
gen.setSource(key.source());
gen.setTarget(key.target());
gen.setContextClass(MicaBeanCopier.class);
gen.setUseConverter(key.isUseConverter());
gen.setNonNull(key.isNonNull());
gen.setUseConverter(key.useConverter());
gen.setNonNull(key.nonNull());
gen.setNamePrefix(BEAN_NAME_PREFIX);
gen.setUseCache(true);
return gen.create(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,10 @@

package net.dreamlu.mica.core.beans;

import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;

/**
* copy key
*
* @author L.cm
*/
@Getter
@EqualsAndHashCode
@AllArgsConstructor
public class MicaBeanCopierKey {
private final Class<?> source;
private final Class<?> target;
private final boolean useConverter;
private final boolean nonNull;
public record MicaBeanCopierKey(Class<?> source, Class<?> target, boolean useConverter, boolean nonNull) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@

package net.dreamlu.mica.core.beans;

import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;

/**
* bean map key,提高性能
*
* @author L.cm
*/
@EqualsAndHashCode
@RequiredArgsConstructor
public class MicaBeanMapKey {
private final Class type;
private final int require;
public record MicaBeanMapKey(Class<?> type, int require) {
}

0 comments on commit 63efafa

Please sign in to comment.