/** * Set an {@link Annotation} that this AnnotationReference shall refer to. * * @param reference an Annotation that this AnnotationReference shall refer to. * @throws IllegalArgumentException if the given annotation has a type that is not compatible with this reference */ public void setReference(Annotation reference) { if (reference == null) { this.reference = null; return; } AnnotationReferenceDataType type = getDataType(); if (type.getAnnotationType().isValueCompatible(reference) // The case if concrete annotation type || reference.getType() instanceof AnnotationType) { this.reference = reference; } else { throw new IllegalArgumentException("Cannot set reference, must be of type " + type + " (was of type " + reference.getType() + ")"); } }
private void buildConfig(AnnotationReferenceDataType type, DocumenttypesConfig.Documenttype.Datatype.Builder dataTypeBuilder) { dataTypeBuilder. type(DocumenttypesConfig.Documenttype.Datatype.Type.Enum.ANNOTATIONREF). annotationref(new DocumenttypesConfig.Documenttype.Datatype.Annotationref.Builder(). annotation(new DocumenttypesConfig.Documenttype.Datatype.Annotationref.Annotation.Builder(). id(type.getAnnotationType().getId()))); }
builder.annotationreftype(new Datatype.Annotationreftype.Builder().annotation(annotationRef.getAnnotationType().getName())); } else if (type instanceof TensorDataType) {