|
|
|
@ -1,12 +1,15 @@
|
|
|
|
|
package com.fr.third.org.hibernate.tuple.entity; |
|
|
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Created by Zed on 2018/11/1. |
|
|
|
|
*/ |
|
|
|
|
public class DefaultEntityRegister { |
|
|
|
|
|
|
|
|
|
private static volatile DefaultEntityRegister instance; |
|
|
|
|
private Class defaultEntityClass = null; |
|
|
|
|
private static Map<Class, Class> MAP = new ConcurrentHashMap<Class, Class>(); |
|
|
|
|
|
|
|
|
|
public static DefaultEntityRegister getInstance() { |
|
|
|
|
if (instance == null) { |
|
|
|
@ -23,19 +26,15 @@ public class DefaultEntityRegister {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void registerDefaultClass(Class defaultEntityClass) { |
|
|
|
|
this.defaultEntityClass = defaultEntityClass; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void resetDefaultClass() { |
|
|
|
|
this.defaultEntityClass = null; |
|
|
|
|
public void registerDefaultClass(Class abstractEntityClass, Class defaultEntityClass) { |
|
|
|
|
MAP.put(abstractEntityClass, defaultEntityClass); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Class getDefaultEntityClass() { |
|
|
|
|
return defaultEntityClass; |
|
|
|
|
public void removeDefaultClass(Class abstractEntityClass) { |
|
|
|
|
MAP.remove(abstractEntityClass); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setDefaultEntityClass(Class defaultEntityClass) { |
|
|
|
|
this.defaultEntityClass = defaultEntityClass; |
|
|
|
|
public Class getDefaultEntityClass(Class abstractEntityClass) { |
|
|
|
|
return MAP.get(abstractEntityClass); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|