void replaceTemporaryTypes() { for (DataType type : dataTypes.values()) { List<DataType> seenStructs = new LinkedList<>(); replaceTemporaryTypes(type, seenStructs); } }
@SuppressWarnings("deprecation") private void replaceTemporaryTypesInStruct(StructDataType structDataType, List<DataType> seenStructs) { seenStructs.add(structDataType); for (Field field : structDataType.getFieldsThisTypeOnly()) { DataType fieldType = field.getDataType(); if (fieldType instanceof TemporaryDataType) { field.setDataType(getDataType(fieldType.getCode(), ((TemporaryDataType)fieldType).getDetailedType())); } else { if (!seenStructs.contains(fieldType)) { replaceTemporaryTypes(fieldType, seenStructs); } } } }
static void configureNewManager(DocumentmanagerConfig config, DocumentTypeManager manager) { if (config == null) { return; } setupAnnotationTypesWithoutPayloads(config, manager); setupAnnotationRefTypes(config, manager); log.log(LogLevel.DEBUG, "Configuring document manager with " + config.datatype().size() + " data types."); ArrayList<DocumentmanagerConfig.Datatype> failed = new ArrayList<>(); failed.addAll(config.datatype()); while (!failed.isEmpty()) { ArrayList<DocumentmanagerConfig.Datatype> tmp = failed; failed = new ArrayList<>(); for (int i = 0; i < tmp.size(); i++) { DocumentmanagerConfig.Datatype thisDataType = tmp.get(i); int id = thisDataType.id(); try { registerTypeIdMapping(config, manager, thisDataType, id); } catch (IllegalArgumentException e) { failed.add(thisDataType); } } } addStructInheritance(config, manager); addAnnotationTypePayloads(config, manager); addAnnotationTypeInheritance(config, manager); manager.replaceTemporaryTypes(); }
private void replaceTemporaryTypesInMap(MapDataType mapDataType, List<DataType> seenStructs) { if (mapDataType.getValueType() instanceof TemporaryDataType) { mapDataType.setValueType(getDataType(mapDataType.getValueType().getCode(), "")); } else { replaceTemporaryTypes(mapDataType.getValueType(), seenStructs); } if (mapDataType.getKeyType() instanceof TemporaryDataType) { mapDataType.setKeyType(getDataType(mapDataType.getKeyType().getCode(), "")); } else { replaceTemporaryTypes(mapDataType.getKeyType(), seenStructs); } }
private void replaceTemporaryTypesInCollection(CollectionDataType collectionDataType, List<DataType> seenStructs) { if (collectionDataType.getNestedType() instanceof TemporaryDataType) { collectionDataType.setNestedType(getDataType(collectionDataType.getNestedType().getCode(), "")); } else { replaceTemporaryTypes(collectionDataType.getNestedType(), seenStructs); } }
private void replaceTemporaryTypesInWeightedSet(WeightedSetDataType weightedSetDataType, List<DataType> seenStructs) { if (weightedSetDataType.getNestedType() instanceof TemporaryDataType) { weightedSetDataType.setNestedType(getDataType(weightedSetDataType.getNestedType().getCode(), "")); } else { replaceTemporaryTypes(weightedSetDataType.getNestedType(), seenStructs); } }