mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
style: 工具类添加私有构造器。
This commit is contained in:
parent
12fac9a78c
commit
ef130bd6b7
@ -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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user