Class Document.AnnotationBuilder

  • Enclosing interface:
    Document

    public static class Document.AnnotationBuilder
    extends Object
    Annotation builder for creating annotations associated with a document
    • Method Detail

      • attribute

        public Document.AnnotationBuilder attribute​(AttributeType type,
                                                    Object value)
        Sets the value of the given AttributeType on the new Annotation to the given value.
        Parameters:
        type - the attribute type
        value - the attribute value
        Returns:
        this annotation builder
      • attributes

        public Document.AnnotationBuilder attributes​(Map<AttributeType<?>,​?> map)
        Adds multiple attributes to the annotation
        Parameters:
        map - the map of attribute types and values
        Returns:
        this annotation builder
      • attributes

        public Document.AnnotationBuilder attributes​(HString copy)
        Adds attributes to this annotation by copying the attributes of another HString object.
        Parameters:
        copy - the HString object whose attributes will be copied
        Returns:
        this annotation builder
      • bounds

        public Document.AnnotationBuilder bounds​(Span span)
        Sets the bounds of this annotation from the given span
        Parameters:
        span - the span to use for the bounds of the annotation
        Returns:
        this annotation builder
      • createAttached

        public Annotation createAttached()
        Creates the annotation and attaches it to the document
        Returns:
        the annotation
      • createDetached

        public Annotation createDetached()
        Creates the annotation associated, but not attached, to the document
        Returns:
        the annotation
      • from

        public Document.AnnotationBuilder from​(@NonNull
                                               @NonNull HString hString)
        Sets the bounds, and adds the relations and attributes from the given HString to this builder.
        Parameters:
        hString - The HString to copy from
        Returns:
        This builder
      • relation

        public Document.AnnotationBuilder relation​(@NonNull
                                                   @NonNull Relation relation)
        Adds the given relation.
        Parameters:
        relation - The relation to add
        Returns:
        This builder
      • relation

        public Document.AnnotationBuilder relation​(@NonNull
                                                   @NonNull Iterable<Relation> relations)
        Adds the given iterable of relations.
        Parameters:
        relations - The relations to add
        Returns:
        This builder