Annotation Type Headers


  • @Retention(RUNTIME)
    @Inherited
    @Target({TYPE,ANNOTATION_TYPE})
    public @interface Headers
    The Headers annotation allows java beans to configure how to handle field names in a given input/output

    With this annotation, you can configure the sequence of headers to use when reading/writing:

    • when reading, the given sequence() of header names will be used to refer to each column, irrespective of whether or not the input contains a header row. If empty, and no headers have been defined in CommonSettings.getHeaders(), the parser will automatically use the first row in the input as the header row, unless the fields in the bean have been annotated using Parsed.index() only.
    • when writing, the given sequence() of names will be used to refer to each column and will be used for writing the header row if write() is enabled. If empty, and no headers have been defined in CommonSettings.getHeaders(), the names given by attributes annotated with Parsed.field() will be used.

    This annotation has no effect if CommonSettings.isAutoConfigurationEnabled() evaluates to false.

    See Also:
    BeanWriterProcessor, BeanProcessor
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean extract
      Indicates whether the first row of on the input should be extracted as a header row.
      java.lang.String[] sequence
      Returns the sequence of header names in the input/output
      boolean write
      Indicates whether a row with headers should be written to the output.
    • Element Detail

      • sequence

        java.lang.String[] sequence
        Returns the sequence of header names in the input/output
        Returns:
        the sequence of header names in the input/output
        Default:
        {}
      • write

        boolean write
        Indicates whether a row with headers should be written to the output.
        Returns:
        a flag indicating whether to write the headers to the output when writing instances of a java bean.
        Default:
        true
      • extract

        boolean extract
        Indicates whether the first row of on the input should be extracted as a header row.
        Returns:
        a flag indicating whether to extract the headers from the first valid row when reading. If
        Default:
        false