use of org.openmuc.jasn1.compiler.model.AsnDefinedType in project jasn1 by openmuc.
the class BerClassWriter method translateModule.
public void translateModule(AsnModule module) throws IOException {
System.out.println("Generating classes for module \"" + module.moduleIdentifier.name + "\"");
outputDirectory = new File(outputBaseDir, sanitizeModuleName(module.moduleIdentifier.name).replace('-', '/').toLowerCase());
this.module = module;
tagDefault = module.tagDefault;
for (AsnType typeDefinition : module.typesByName.values()) {
if (typeDefinition instanceof AsnDefinedType) {
if (getInformationObjectClass(((AsnDefinedType) typeDefinition).typeName, module) != null) {
continue;
}
}
String typeName = cleanUpName(typeDefinition.name);
writeClassHeader(typeName, module);
if (typeDefinition instanceof AsnTaggedType) {
AsnTaggedType asnTaggedType = (AsnTaggedType) typeDefinition;
Tag tag = getTag(asnTaggedType);
if (asnTaggedType.definedType != null) {
writeRetaggingTypeClass(typeName, asnTaggedType.definedType.typeName, typeDefinition, tag);
} else {
AsnType assignedAsnType = asnTaggedType.typeReference;
if (assignedAsnType instanceof AsnConstructedType) {
writeConstructedTypeClass(typeName, assignedAsnType, tag, false, null);
} else {
writeRetaggingTypeClass(typeName, getBerType(assignedAsnType), typeDefinition, tag);
}
}
} else if (typeDefinition instanceof AsnDefinedType) {
writeRetaggingTypeClass(typeName, ((AsnDefinedType) typeDefinition).typeName, typeDefinition, null);
} else if (typeDefinition instanceof AsnConstructedType) {
writeConstructedTypeClass(typeName, typeDefinition, null, false, null);
} else {
writeRetaggingTypeClass(typeName, getBerType(typeDefinition), typeDefinition, null);
}
out.close();
}
writeOidValues(module);
}
Aggregations