This example displays the number of the fields in the document.
TextFields fields = document.getFields(); System.out.println(fields.getCount());
Related information
Count property