Package com.igormaznitsa.jbbp.utils
Class JBBPCustomFieldTypeProcessorAggregator
java.lang.Object
com.igormaznitsa.jbbp.utils.JBBPCustomFieldTypeProcessorAggregator
- All Implemented Interfaces:
JBBPCustomFieldTypeProcessor
public class JBBPCustomFieldTypeProcessorAggregator
extends Object
implements JBBPCustomFieldTypeProcessor
The Aggregator allows to join several custom field type processors.
- Since:
- 1.2.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor. -
Method Summary
Modifier and TypeMethodDescriptionString[]Get custom types of fields supported by the custom type field processor.booleanisAllowed(JBBPFieldTypeParameterContainer fieldType, String fieldName, int extraData, boolean isArray) Called by compiler to check parameters for custom field.readCustomFieldType(JBBPBitInputStream in, JBBPBitOrder bitOrder, int parserFlags, JBBPFieldTypeParameterContainer fieldType, JBBPNamedFieldInfo fieldName, int extraData, boolean readWholeStream, int arrayLength, JBBPArraySizeLimiter arraySizeLimiter) Read custom field from stream and return the data as a JBBP field.
-
Constructor Details
-
JBBPCustomFieldTypeProcessorAggregator
Constructor.- Parameters:
processors- processors which should be joined.
-
-
Method Details
-
getCustomFieldTypes
Description copied from interface:JBBPCustomFieldTypeProcessorGet custom types of fields supported by the custom type field processor.- Specified by:
getCustomFieldTypesin interfaceJBBPCustomFieldTypeProcessor- Returns:
- array of strings where every string is custom field type in lower-case.
-
isAllowed
public boolean isAllowed(JBBPFieldTypeParameterContainer fieldType, String fieldName, int extraData, boolean isArray) Description copied from interface:JBBPCustomFieldTypeProcessorCalled by compiler to check parameters for custom field.- Specified by:
isAllowedin interfaceJBBPCustomFieldTypeProcessor- Parameters:
fieldType- field type info, it must not be nullfieldName- name of the field, it can be null for anonymous fieldsextraData- number placed as extra value for field, followed by ':' if not presented then zero, if it is expression then -1isArray- flag shows that the field describes an array- Returns:
- true if such configuration allowed, false otherwise
-
readCustomFieldType
public JBBPAbstractField readCustomFieldType(JBBPBitInputStream in, JBBPBitOrder bitOrder, int parserFlags, JBBPFieldTypeParameterContainer fieldType, JBBPNamedFieldInfo fieldName, int extraData, boolean readWholeStream, int arrayLength, JBBPArraySizeLimiter arraySizeLimiter) throws IOException Description copied from interface:JBBPCustomFieldTypeProcessorRead custom field from stream and return the data as a JBBP field.- Specified by:
readCustomFieldTypein interfaceJBBPCustomFieldTypeProcessor- Parameters:
in- the data source stream, must not be nullbitOrder- the bit order defined for parsing, must not be nullparserFlags- the flags defined for parsingfieldType- the current field type info, must not be nullfieldName- the field name info, it can be null if the field is anonymous oneextraData- extra numeric value for the field, followed by ':', if not presented then 0readWholeStream- if true then the field is array which should contain parse data for whole stream till the endarrayLength- -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- See Also:
-