private void registerDefaultDataTypes() { DocumentType superDocType = DataType.DOCUMENT; dataTypes.put(superDocType.getId(), superDocType); documentTypes.put(superDocType.getDataTypeName(), superDocType); Class<? extends DataType> dataTypeClass = DataType.class; for (java.lang.reflect.Field field : dataTypeClass.getFields()) { if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) { if (DataType.class.isAssignableFrom(field.getType())) { try { //these are all static final DataTypes listed in DataType: DataType type = (DataType) field.get(null); register(type); } catch (IllegalAccessException e) { //ignore } } } } for (AnnotationType type : AnnotationTypes.ALL_TYPES) { annotationTypeRegistry.register(type); } }
private void visit(SDDocumentType docOrStruct) { int id; if (docOrStruct.isStruct()) { id = new StructDataType(docOrStruct.getName()).getId(); } else { id = new DocumentType(docOrStruct.getName()).getId(); } if (seenTypes.contains(id)) { return; } else { seenTypes.add((new StructDataType(docOrStruct.getName()).getId())); } for (Field field : docOrStruct.fieldSet()) { if (!seenTypes.contains(field.getDataType().getId())) { //we haven't seen this before, do it visit(field.getDataType()); } } processingOrder.add(docOrStruct); }