40 lines
1.1 KiB
Plaintext
Executable File
40 lines
1.1 KiB
Plaintext
Executable File
package com.fp.hbm.bgenerator;
|
|
|
|
public enum MappingType {
|
|
XML("XML","com.fp.hbm.bgenerator.xml.Mapper", "com.fp.hbm.bgenerator.xml.MapperColumn"),
|
|
ANN("ANN","com.fp.hbm.bgenerator.ann.Mapper", "com.fp.hbm.bgenerator.ann.MapperColumn");
|
|
private String type;
|
|
|
|
private String mapper;
|
|
|
|
private String column;
|
|
|
|
private MappingType(String pType, String pMapper, String pColumn) {
|
|
this.type = pType;
|
|
this.mapper = pMapper;
|
|
this.column = pColumn;
|
|
}
|
|
|
|
public AbstractColumn getColumn() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
|
|
return (AbstractColumn) Class.forName(this.column).newInstance();
|
|
}
|
|
|
|
public AbstractMapper getMapper() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
|
|
return (AbstractMapper) Class.forName(mapper).newInstance();
|
|
}
|
|
|
|
public String getType() {
|
|
return type;
|
|
}
|
|
|
|
public static MappingType find(String pType) {
|
|
MappingType[] m = values();
|
|
for (MappingType ty : m) {
|
|
if (ty.type.compareTo(pType) == 0) {
|
|
return ty;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|