Annotation Type Field


  • @Retention(RUNTIME)
    @Target({FIELD,METHOD,PARAMETER})
    public @interface Field
    Field annotation applied to class attributes, methods or constructor parameters.
    Since:
    2.1.0
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Align align
      The alignment of a padded field.
      int at
      Sets the absolute position of the field.
      java.lang.Class<?> collection
      The collection type for repeating fields, if it cannot be detected from the field or method declaration.
      java.lang.String defaultValue
      The default value for this field.
      java.lang.String format
      The format passed to the TypeHandler.
      java.lang.String getter
      The getter method.
      java.lang.Class<?> handlerClass
      The TypeHandler implementation class for this field.
      java.lang.String handlerName
      The name of a registered TypeHandler.
      boolean keepPadding
      Whether to keep the field padding during unmarshalling.
      boolean lazy
      Whether an empty string should be converted to null, or null returned for an empty collection.
      int length
      The padded length of the field.
      boolean lenientPadding
      Whether to enforce the padding length during unmarshalling.
      java.lang.String literal
      The literal text for validating or matching field text.
      int maxLength
      The maximum length of the field text (after trimming if enabled).
      int maxOccurs
      The maximum occurrences of the field if it repeats.
      int minLength
      The minimum length of the field text (after trimming if enabled).
      int minOccurs
      The minimum occurrences of the field.
      java.lang.String name
      The field name.
      boolean nillable
      Whether the element is nillable.
      java.lang.String occursRef
      The name of a preceding field that governs the number of occurrences of this field.
      int ordinal
      The relative position of the field.
      int padding
      The character used to pad the field.
      java.lang.String regex
      The regular expression for validating and/or matching field text.
      boolean required
      Whether field text is required.
      boolean rid
      Whether the field is used to identify the record.
      java.lang.String setter
      The setter method.
      boolean trim
      Whether to trim the field text before validation and type handling.
      java.lang.Class<?> type
      The field type, if it can not be detected from the method or field declaration.
      int until
      Sets the maximum position of a field that repeats for an indeterminate number of times.
      java.lang.String xmlName
      The XML attribute or element name.
      java.lang.String xmlNamespace
      The XML namespace URI of this field.
      java.lang.String xmlPrefix
      The XML namespace prefix of this field.
      XmlType xmlType
      The XML type of this field.
    • Element Detail

      • name

        java.lang.String name
        The field name.
        Returns:
        the field name
        Default:
        ""
      • at

        int at
        Sets the absolute position of the field.
        Returns:
        the absolute position
        Default:
        -2147483648
      • until

        int until
        Sets the maximum position of a field that repeats for an indeterminate number of times.
        Returns:
        the maximum position
        Default:
        -2147483648
      • ordinal

        int ordinal
        The relative position of the field.
        Returns:
        the relative position
        Default:
        -2147483648
      • length

        int length
        The padded length of the field.
        Returns:
        the length
        Default:
        -2147483648
      • padding

        int padding
        The character used to pad the field.
        Returns:
        the character
        Default:
        -2147483648
      • keepPadding

        boolean keepPadding
        Whether to keep the field padding during unmarshalling. Only applies to fixed length formatted streams.
        Returns:
        true to keep padding, false otherwise
        Default:
        false
      • lenientPadding

        boolean lenientPadding
        Whether to enforce the padding length during unmarshalling. Only applies to fixed length formatted streams.
        Returns:
        true if not enforced, false otherwise
        Default:
        false
      • align

        Align align
        The alignment of a padded field.
        Returns:
        Align
        Default:
        org.beanio.builder.Align.LEFT
      • getter

        java.lang.String getter
        The getter method.
        Returns:
        the getter method name
        Default:
        ""
      • setter

        java.lang.String setter
        The setter method.
        Returns:
        the setter method name
        Default:
        ""
      • type

        java.lang.Class<?> type
        The field type, if it can not be detected from the method or field declaration.
        Returns:
        the field type
        Default:
        java.lang.Void.class
      • handlerClass

        java.lang.Class<?> handlerClass
        The TypeHandler implementation class for this field.
        Returns:
        the type handler class
        Default:
        java.lang.Void.class
      • handlerName

        java.lang.String handlerName
        The name of a registered TypeHandler.
        Returns:
        the type handler name
        Default:
        ""
      • format

        java.lang.String format
        The format passed to the TypeHandler.
        Returns:
        the format pattern
        Default:
        ""
      • trim

        boolean trim
        Whether to trim the field text before validation and type handling.
        Returns:
        true to trim, false otherwise
        Default:
        false
      • rid

        boolean rid
        Whether the field is used to identify the record.
        Returns:
        true if it identifies the record, false otherwise
        Default:
        false
      • regex

        java.lang.String regex
        The regular expression for validating and/or matching field text.
        Returns:
        the pattern
        Default:
        ""
      • literal

        java.lang.String literal
        The literal text for validating or matching field text.
        Returns:
        the expected literal text
        Default:
        ""
      • required

        boolean required
        Whether field text is required.
        Returns:
        true if field text must be at least one character (after trimming if enabled), or false otherwise
        Default:
        false
      • defaultValue

        java.lang.String defaultValue
        The default value for this field. The value is parsed into a Java object using the assigned type handler.
        Default:
        ""
      • minLength

        int minLength
        The minimum length of the field text (after trimming if enabled).
        Returns:
        the minimum length
        Default:
        -2147483648
      • maxLength

        int maxLength
        The maximum length of the field text (after trimming if enabled).
        Returns:
        the maximum length
        Default:
        -2147483648
      • collection

        java.lang.Class<?> collection
        The collection type for repeating fields, if it cannot be detected from the field or method declaration.
        Returns:
        the collection type
        Default:
        java.lang.Void.class
      • lazy

        boolean lazy
        Whether an empty string should be converted to null, or null returned for an empty collection.
        Returns:
        whether the field collection is lazily created
        Default:
        false
      • minOccurs

        int minOccurs
        The minimum occurrences of the field.
        Returns:
        the minimum occurrences
        Default:
        -2147483648
      • maxOccurs

        int maxOccurs
        The maximum occurrences of the field if it repeats.
        Returns:
        the maximum occurrences, or -1 if unbounded
        Default:
        -2147483648
      • occursRef

        java.lang.String occursRef
        The name of a preceding field that governs the number of occurrences of this field. Does not apply to XML formatted streams.
        Returns:
        the name of the field
        Default:
        ""
      • xmlType

        XmlType xmlType
        The XML type of this field.
        Returns:
        the XmlType
        Default:
        org.beanio.builder.XmlType.DEFAULT
      • xmlName

        java.lang.String xmlName
        The XML attribute or element name.
        Returns:
        the XML name
        Default:
        "{undefined}"
      • xmlPrefix

        java.lang.String xmlPrefix
        The XML namespace prefix of this field.
        Returns:
        the namespace prefix
        Default:
        "{undefined}"
      • xmlNamespace

        java.lang.String xmlNamespace
        The XML namespace URI of this field.
        Returns:
        the namespace URI
        Default:
        "{undefined}"
      • nillable

        boolean nillable
        Whether the element is nillable.
        Returns:
        true if nillable, false otherwise
        Default:
        false