Class SelectionFilter


  • public final class SelectionFilter
    extends java.lang.Object
    The optional "which annotations/fields" narrowing both XfdfExporter and XfdfImporter accept: a type filter and an ID filter, either or both of which may be unset (meaning "no restriction" for that one).
    • Type -- an annotation's XFDF element name (e.g. "square", "freetext"; matches XfdfAnnotation.getType()) or a field's PDF /FT code ("Tx", "Btn", "Ch", "Sig") -- always compared case-insensitively. The two vocabularies don't overlap, so one comma-separated list naturally selects from both at once, e.g. "square,circle,tx" keeps only Square/Circle annotations and text fields.
    • ID -- an annotation's own /NM or a field's fully-qualified name, compared exactly (case-sensitively, since both are exact PDF identifiers, not free text) -- the same combined-list reasoning applies.
    Passing both narrows to their intersection: an item must match the type filter and the ID filter (whichever of the two is actually set).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static SelectionFilter NONE
      Matches everything -- the default when neither types nor ids is configured.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasIdFilter()
      true if this filter restricts by ID at all.
      boolean hasTypeFilter()
      true if this filter restricts by type at all -- lets a caller skip work it wouldn't need otherwise.
      boolean includes​(java.lang.String type, java.lang.String id)  
      static SelectionFilter of​(java.lang.String typesCsv, java.lang.String idsCsv)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NONE

        public static final SelectionFilter NONE
        Matches everything -- the default when neither types nor ids is configured.
    • Method Detail

      • of

        public static SelectionFilter of​(java.lang.String typesCsv,
                                         java.lang.String idsCsv)
        Parameters:
        typesCsv - comma-separated type tokens, or null/blank for no type restriction
        idsCsv - comma-separated /NM/field-name tokens, or null/blank for no ID restriction
      • hasTypeFilter

        public boolean hasTypeFilter()
        true if this filter restricts by type at all -- lets a caller skip work it wouldn't need otherwise.
      • hasIdFilter

        public boolean hasIdFilter()
        true if this filter restricts by ID at all.
      • includes

        public boolean includes​(java.lang.String type,
                                java.lang.String id)
        Parameters:
        type - the item's type token (an XFDF annotation type or a field's /FT code); never null
        id - the item's /NM or fully-qualified field name, or null if it has none