style: 工具类添加私有构造器。

This commit is contained in:
Suomm 2023-07-12 10:24:26 +08:00
parent 12fac9a78c
commit ef130bd6b7

View File

@ -38,15 +38,18 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class RelationManager { public class RelationManager {
private static Map<Class<?>, List<AbstractRelation>> classRelations = new ConcurrentHashMap<>(); private RelationManager() {
}
private static List<AbstractRelation> getRelations(Class<?> clazz) { private static Map<Class<?>, List<AbstractRelation>> classRelations = new ConcurrentHashMap<>();
return MapUtil.computeIfAbsent(classRelations, clazz, RelationManager::doGetRelations);
}
private static List<AbstractRelation> doGetRelations(Class<?> entityClass) { private static List<AbstractRelation> getRelations(Class<?> clazz) {
List<Field> allFields = ClassUtil.getAllFields(entityClass); return MapUtil.computeIfAbsent(classRelations, clazz, RelationManager::doGetRelations);
List<AbstractRelation> relations = new ArrayList<>(); }
private static List<AbstractRelation> doGetRelations(Class<?> entityClass) {
List<Field> allFields = ClassUtil.getAllFields(entityClass);
List<AbstractRelation> relations = new ArrayList<>();
for (Field field : allFields) { for (Field field : allFields) {
RelationManyToMany manyToManyAnnotation = field.getAnnotation(RelationManyToMany.class); RelationManyToMany manyToManyAnnotation = field.getAnnotation(RelationManyToMany.class);
if (manyToManyAnnotation != null) { if (manyToManyAnnotation != null) {