Class AbstractMappedClassFieldObserver

java.lang.Object
com.igormaznitsa.jbbp.io.AbstractMappedClassFieldObserver
Direct Known Subclasses:
JBBPOut

public abstract class AbstractMappedClassFieldObserver extends Object
Abstract class to collect, order and process all fields in a mapped class. since 1.1
  • Constructor Details

    • AbstractMappedClassFieldObserver

      public AbstractMappedClassFieldObserver()
  • Method Details

    • processObject

      protected void processObject(Object obj, Field field, BinAnnotationWrapper binAnnotationWrapper, Object customFieldProcessor)
      Process an object. It works only with classes and fields marked by Bin annotations. It doesn't process classes and fields marked by DslBinCustom annotations.
      Parameters:
      obj - an object which is an instance of a mapped class, must not be null
      field - a field where the object has been found, it can be null for first call
      binAnnotationWrapper - wrapper to replace Bin annotation values for processing fields, can be null to be ignored
      customFieldProcessor - a processor for custom fields, it can be null
      Since:
      2.0.2
      See Also:
    • processObject

      protected void processObject(Object obj, Field field, BinAnnotationWrapper binAnnotationWrapper, BinFieldFilter binFieldFilter, Object customFieldProcessor)
      Process an object. It works only with classes and fields marked by Bin annotations. It doesn't process classes and fields marked by DslBinCustom annotations.
      Parameters:
      obj - an object which is an instance of a mapped class, must not be null
      field - a field where the object has been found, it can be null for first call
      binAnnotationWrapper - wrapper to replace Bin annotation values for processing fields, can be null to be ignored
      binFieldFilter - filter for mapped fields, allows to exclude some of them, can be null
      customFieldProcessor - a processor for custom fields, it can be null
      Since:
      2.0.4
      See Also:
    • processObjectField

      protected void processObjectField(Object obj, MappedFieldRecord fieldRecord, Bin annotation, Object customFieldProcessor)
      Inside auxiliary method to process a field of an object.
      Parameters:
      obj - the object which field under processing, must not be null
      fieldRecord - internal record about the field, must not be null
      annotation - the annotation to be used as data source about the field, must not be null
      customFieldProcessor - an object which will be provided for processing of custom fields, must not be null if object contains custom fields
      Since:
      2.0.4
    • processObjectField

      protected void processObjectField(Object obj, MappedFieldRecord fieldRecord, Bin annotation, Object customFieldProcessor, BinFieldFilter binFieldFilter)
      Inside auxiliary method to process a field of an object.
      Parameters:
      obj - the object which field under processing, must not be null
      fieldRecord - internal record about the field, must not be null
      annotation - the annotation to be used as data source about the field, must not be null
      customFieldProcessor - an object which will be provided for processing of custom fields, must not be null if object contains custom fields
      binFieldFilter - filter allows to exclude some fields from process, can be null
      Since:
      2.0.4
    • onFieldCustom

      protected void onFieldCustom(Object obj, Field field, Bin annotation, Object customFieldProcessor, Object value)
      Notification about custom field.
      Parameters:
      obj - the object instance, must not be null
      field - the custom field, must not be null
      annotation - the annotation for the field, must not be null
      customFieldProcessor - processor for custom fields, must not be null
      value - the value of the custom field
    • onFieldBits

      protected void onFieldBits(Object obj, Field field, Bin annotation, JBBPBitNumber bitNumber, int value)
      Notification about bit field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      bitNumber - number of bits for the field, must not be null
      value - the value of the field
    • onFieldBool

      protected void onFieldBool(Object obj, Field field, Bin annotation, boolean value)
      Notification about boolean field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      value - the value of the field
    • onFieldByte

      protected void onFieldByte(Object obj, Field field, Bin annotation, boolean signed, int value)
      Notification about byte field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      signed - flag shows that the field id signed
      value - the value of the field
    • onFieldShort

      protected void onFieldShort(Object obj, Field field, Bin annotation, boolean signed, int value)
      Notification about short field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      signed - flag shows that the field id signed
      value - the value of the field
    • onFieldInt

      protected void onFieldInt(Object obj, Field field, Bin annotation, int value)
      Notification about integer field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      value - the value of the field
    • onFieldUInt

      protected void onFieldUInt(Object obj, Field field, Bin annotation, int value)
      Notification about unsigned integer field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      value - the value of the field
      Since:
      2.0.4
    • onFieldFloat

      protected void onFieldFloat(Object obj, Field field, Bin annotation, float value)
      Notification about float field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      value - the value of the field
      Since:
      1.4.0
    • onFieldString

      protected void onFieldString(Object obj, Field field, Bin annotation, String value)
      Notification about string field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      value - the value of the field
      Since:
      1.4.0
    • onFieldDouble

      protected void onFieldDouble(Object obj, Field field, Bin annotation, double value)
      Notification about double field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      value - the value of the field
      Since:
      1.4.0
    • onFieldLong

      protected void onFieldLong(Object obj, Field field, Bin annotation, long value)
      Notification about long field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      value - the value of the field
    • onStructStart

      protected void onStructStart(Object obj, Field field, Bin annotation)
      Notification of start of "structure" field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
    • onStructEnd

      protected void onStructEnd(Object obj, Field field, Bin annotation)
      Notification of end of "structure" field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
    • onArrayStart

      protected void onArrayStart(Object obj, Field field, Bin annotation, int length)
      Notification of start of "array" field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for field, must not be null
      length - the length of the array
    • onArrayEnd

      protected void onArrayEnd(Object obj, Field field, Bin annotation)
      Notification of end of "array" field.
      Parameters:
      obj - the object instance, must not be null
      field - the field, must not be null
      annotation - the annotation for the field, must not be null