use of org.hl7.fhir.core.generator.analysis.TypeInfo in project org.hl7.fhir.core by hapifhir.
the class JavaFactoryGenerator method genCaseFactory.
private String genCaseFactory() {
StringBuilder b = new StringBuilder();
for (StructureDefinition sd : definitions.getStructures().getSortedList()) {
if (sd.getKind() == StructureDefinitionKind.RESOURCE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && !sd.getAbstract()) {
String tn = ((TypeInfo) sd.getUserData("java.type.info")).getName();
b.append(" case " + Integer.toString(sd.getName().hashCode()) + ": return new " + tn + "();\r\n");
}
}
for (StructureDefinition sd : definitions.getStructures().getSortedList()) {
if (sd.getKind() == StructureDefinitionKind.COMPLEXTYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && !sd.getAbstract()) {
String tn = ((TypeInfo) sd.getUserData("java.type.info")).getName();
b.append(" case " + Integer.toString(sd.getName().hashCode()) + ": return new " + tn + "();\r\n");
}
}
return b.toString();
}
use of org.hl7.fhir.core.generator.analysis.TypeInfo in project org.hl7.fhir.core by hapifhir.
the class JavaFactoryGenerator method genResourceFactory.
private String genResourceFactory() {
StringBuilder b = new StringBuilder();
for (StructureDefinition sd : definitions.getStructures().getSortedList()) {
if (sd.getKind() == StructureDefinitionKind.RESOURCE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && !sd.getAbstract()) {
String tn = ((TypeInfo) sd.getUserData("java.type.info")).getName();
b.append(" if (\"" + sd.getName() + "\".equals(name))\r\n");
b.append(" return new " + tn + "();\r\n");
}
}
return b.toString();
}
use of org.hl7.fhir.core.generator.analysis.TypeInfo in project org.hl7.fhir.core by hapifhir.
the class JavaParserRdfGenerator method genInnerAbstractComposer.
private void genInnerAbstractComposer(Analysis analysis, TypeInfo ti) throws IOException, Exception {
String tn = ti.getName();
composer.append(" protected void compose" + tn + "(Complex t, String parentType, String name, " + tn + " element, int index) {\r\n");
composer.append(" compose" + ti.getAncestorName() + "(t, parentType, name, element, index);\r\n");
for (ElementDefinition ed : ti.getChildren()) {
genElement(analysis, ti, ed, null);
}
composer.append(" }\r\n\r\n");
}
Aggregations