public AnnotationType findAnnotation(String name) { return annotationTypes.getType(name); }
public Collection<AnnotationType> getAnnotations() { return annotationTypes.getTypes().values(); } public AnnotationType findAnnotation(String name) { return annotationTypes.getType(name); }
public NewDocumentType add(AnnotationType type) { annotations.register(type); return this; } public NewDocumentType add(DataType type) {
public AnnotationType getAnnotationType(int id) { AnnotationType a = annotations.getType(id); if (a != null) { return a; } else { for (NewDocumentType dt : getInherited()) { a = dt.getAnnotationType(id); if (a != null) { return a; } } } return null; }
public SDDocumentType addAnnotation(AnnotationType annotation) { annotationTypes.register(annotation); return this; }
public Collection<AnnotationType> getAnnotations() { return annotations.getTypes().values(); } public Collection<AnnotationType> getAllAnnotations() {
public AnnotationType getAnnotationType(String name) { AnnotationType a = annotations.getType(name); if (a != null) { return a; } else { for (NewDocumentType dt : getInherited()) { a = dt.getAnnotationType(name); if (a != null) { return a; } } } return null; } public AnnotationType getAnnotationType(int id) {
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); } }
public Map<String, AnnotationType> getAnnotationTypes() { return handler.getDocumentTypeManager().getAnnotationTypeRegistry().getTypes(); }
private static void addAnnotationTypeInheritance(DocumentmanagerConfig config, DocumentTypeManager manager) { for (DocumentmanagerConfig.Annotationtype annType : config.annotationtype()) { if (annType.inherits().size() > 0) { AnnotationType inheritedType = manager.getAnnotationTypeRegistry().getType(annType.inherits(0).id()); AnnotationType type = manager.getAnnotationTypeRegistry().getType(annType.id()); type.inherit(inheritedType); } } }
private static void setupAnnotationTypesWithoutPayloads(DocumentmanagerConfig config, DocumentTypeManager manager) { for (DocumentmanagerConfig.Annotationtype annType : config.annotationtype()) { AnnotationType annotationType = new AnnotationType(annType.name(), annType.id()); manager.getAnnotationTypeRegistry().register(annotationType); } }
private static void setupAnnotationRefTypes(DocumentmanagerConfig config, DocumentTypeManager manager) { for (int i = 0; i < config.datatype().size(); i++) { DocumentmanagerConfig.Datatype thisDataType = config.datatype(i); int id = thisDataType.id(); for (Object o : thisDataType.annotationreftype()) { DocumentmanagerConfig.Datatype.Annotationreftype annRefType = (DocumentmanagerConfig.Datatype.Annotationreftype) o; AnnotationType annotationType = manager.getAnnotationTypeRegistry().getType(annRefType.annotation()); if (annotationType == null) { throw new IllegalArgumentException("Found reference to " + annRefType.annotation() + ", which does not exist!"); } AnnotationReferenceDataType type = new AnnotationReferenceDataType(annotationType, id); manager.register(type); } } }
private static void addAnnotationTypePayloads(DocumentmanagerConfig config, DocumentTypeManager manager) { for (DocumentmanagerConfig.Annotationtype annType : config.annotationtype()) { AnnotationType annotationType = manager.getAnnotationTypeRegistry().getType(annType.id()); DataType payload = manager.getDataType(annType.datatype(), ""); if (!payload.equals(DataType.NONE)) { annotationType.setDataType(payload); } } }
public void read(Annotation annotation) { int annotationTypeId = buf.getInt(); AnnotationType type = manager.getAnnotationTypeRegistry().getType(annotationTypeId);
public void read(Annotation annotation) { int annotationTypeId = buf.getInt(); AnnotationType type = manager.getAnnotationTypeRegistry().getType(annotationTypeId);