Interface JBBPCustomFieldTypeProcessor

All Known Implementing Classes:
JBBPCustomFieldTypeProcessorAggregator

public interface JBBPCustomFieldTypeProcessor
Allows to define and process own custom field types during parsing.
Since:
1.2.0
  • Method Details

    • getCustomFieldTypes

      String[] getCustomFieldTypes()
      Get custom types of fields supported by the custom type field processor.
      Returns:
      array of strings where every string is custom field type in lower-case.
    • isAllowed

      boolean isAllowed(JBBPFieldTypeParameterContainer fieldType, String fieldName, int extraData, boolean isArray)
      Called by compiler to check parameters for custom field.
      Parameters:
      fieldType - field type info, it must not be null
      fieldName - name of the field, it can be null for anonymous fields
      extraData - number placed as extra value for field, followed by ':' if not presented then zero, if it is expression then -1
      isArray - flag shows that the field describes an array
      Returns:
      true if such configuration allowed, false otherwise
    • readCustomFieldType

      JBBPAbstractField readCustomFieldType(JBBPBitInputStream in, JBBPBitOrder bitOrder, int parserFlags, JBBPFieldTypeParameterContainer customTypeFieldInfo, JBBPNamedFieldInfo fieldName, int extraData, boolean readWholeStream, int arrayLength, JBBPArraySizeLimiter arraySizeLimiter) throws IOException
      Read custom field from stream and return the data as a JBBP field.
      Parameters:
      in - the data source stream, must not be null
      bitOrder - the bit order defined for parsing, must not be null
      parserFlags - the flags defined for parsing
      customTypeFieldInfo - the current field type info, must not be null
      fieldName - the field name info, it can be null if the field is anonymous one
      extraData - extra numeric value for the field, followed by ':', if not presented then 0
      readWholeStream - if true then the field is array which should contain parse data for whole stream till the end
      arrayLength - -1 if it is not array else length of the array to be read.
      arraySizeLimiter - limiter to check number of elements during whole stream array read, must not be null
      Returns:
      parsed data as JBBP field, must not be null
      Throws:
      IOException - it can be thrown for transport errors
      JBBPReachedArraySizeLimitException - thrown if reached limit for a whole stream array
      Since:
      2.1.0
      See Also: