浏览代码

添加 removeTypeMapping(...)

James 4 年之前
父节点
当前提交
bd49bdb656

+ 8 - 0
src/main/java/com/jfinal/plugin/activerecord/generator/Generator.java

@@ -140,6 +140,10 @@ public class Generator {
 		this.metaBuilder.typeMapping.addMapping(from, to);
 		this.metaBuilder.typeMapping.addMapping(from, to);
 	}
 	}
 	
 	
+	public void removeTypeMapping(Class<?> from) {
+		this.metaBuilder.typeMapping.removeMapping(from);
+	}
+	
 	/**
 	/**
 	 * 与 addTypeMaping(Class<?> from, Class<?> to) 功能一致,保是参数类型不同
 	 * 与 addTypeMaping(Class<?> from, Class<?> to) 功能一致,保是参数类型不同
 	 * 
 	 * 
@@ -150,6 +154,10 @@ public class Generator {
 		this.metaBuilder.typeMapping.addMapping(from, to);
 		this.metaBuilder.typeMapping.addMapping(from, to);
 	}
 	}
 	
 	
+	public void removeTypeMapping(String from) {
+		this.metaBuilder.typeMapping.removeMapping(from);
+	}
+	
 	/**
 	/**
 	 * 设置 MappingKitGenerator,便于扩展自定义 MappingKitGenerator
 	 * 设置 MappingKitGenerator,便于扩展自定义 MappingKitGenerator
 	 */
 	 */

+ 8 - 0
src/main/java/com/jfinal/plugin/activerecord/generator/TypeMapping.java

@@ -101,6 +101,14 @@ public class TypeMapping {
 		map.put(from, to);
 		map.put(from, to);
 	}
 	}
 	
 	
+	public void removeMapping(Class<?> from) {
+		map.remove(from.getName());
+	}
+	
+	public void removeMapping(String from) {
+		map.remove(from);
+	}
+	
 	public String getType(String typeString) {
 	public String getType(String typeString) {
 		return map.get(typeString);
 		return map.get(typeString);
 	}
 	}