1 回答
TA贡献1818条经验 获得超11个赞
我们找到了一种结合这两种行为的方法。
public class CustomModelCanonicalClassFactory extends CustomModelClassFactory {
private String customVersion;
public CustomModelCanonicalClassFactory(String packageName, String version){
super(packageName);
if (version == null || !Version.supportsVersion(version)) {
throw new IllegalArgumentException("Unknown version: " + version);
}
this.customVersion = version;
}
}
然后覆盖你需要的所有方法,将显式版本提供给 super#method
@Override
public Class<? extends Message> getMessageClass(String name, String version, boolean isExplicit) throws HL7Exception {
return super.getMessageClass(name, this.customVersion, isExplicit);
}
@Override
public Class<? extends Group> getGroupClass(String name, String version) throws HL7Exception {
return super.getGroupClass(name, this.customVersion);
}
最好的问候,帕特里克
添加回答
举报