1818
1919import com .igormaznitsa .jbbp .exceptions .JBBPException ;
2020import com .igormaznitsa .jbbp .exceptions .JBBPIllegalArgumentException ;
21- import com .igormaznitsa .jbbp .mapper .*;
21+ import com .igormaznitsa .jbbp .mapper .Bin ;
22+ import com .igormaznitsa .jbbp .mapper .BinFieldFilter ;
23+ import com .igormaznitsa .jbbp .mapper .BinType ;
24+ import com .igormaznitsa .jbbp .mapper .JBBPMapper ;
25+ import com .igormaznitsa .jbbp .mapper .MappedFieldRecord ;
2226import com .igormaznitsa .jbbp .model .JBBPFieldInt ;
2327import com .igormaznitsa .jbbp .model .JBBPFieldLong ;
2428import com .igormaznitsa .jbbp .model .JBBPFieldShort ;
2529import com .igormaznitsa .jbbp .model .JBBPFieldString ;
30+ import com .igormaznitsa .jbbp .model .JBBPFieldUInt ;
2631import com .igormaznitsa .jbbp .utils .BinAnnotationWrapper ;
2732import com .igormaznitsa .jbbp .utils .JBBPUtils ;
28-
2933import java .lang .reflect .Array ;
3034import java .lang .reflect .Field ;
3135import java .util .List ;
@@ -252,6 +256,15 @@ protected void processObjectField(
252256 this .onFieldInt (obj , field , annotation , value );
253257 }
254258 break ;
259+ case UINT : {
260+ long value ;
261+ value = ((Number ) readFieldValue (obj , fieldRecord )).longValue ();
262+ if (reverseBits ) {
263+ value = (int ) JBBPFieldUInt .reverseBits (value );
264+ }
265+ this .onFieldUInt (obj , field , annotation , (int ) value );
266+ }
267+ break ;
255268 case FLOAT : {
256269 float value ;
257270 if (float .class == fieldType ) {
@@ -261,7 +274,7 @@ protected void processObjectField(
261274 }
262275 if (reverseBits ) {
263276 value =
264- Float .intBitsToFloat ((int ) JBBPFieldInt .reverseBits (Float .floatToIntBits (value )));
277+ Float .intBitsToFloat ((int ) JBBPFieldInt .reverseBits (Float .floatToIntBits (value )));
265278 }
266279 this .onFieldFloat (obj , field , annotation , value );
267280 }
@@ -433,13 +446,28 @@ protected void processObjectField(
433446 float value = Array .getFloat (array , i );
434447 if (reverseBits ) {
435448 value = Float
436- .intBitsToFloat ((int ) JBBPFieldInt .reverseBits (Float .floatToIntBits (value )));
449+ .intBitsToFloat ((int ) JBBPFieldInt .reverseBits (Float .floatToIntBits (value )));
437450 }
438451 this .onFieldFloat (obj , field , annotation , value );
439452 }
440453 this .onArrayEnd (obj , field , annotation );
441454 }
442455 break ;
456+ case UINT_ARRAY : {
457+ assertFieldArray (field );
458+ final int len = Array .getLength (array );
459+ this .onArrayStart (obj , field , annotation , len );
460+ for (int i = 0 ; i < len ; i ++) {
461+ long value = ((Number ) Array .get (array , i )).longValue ();
462+ if (reverseBits ) {
463+ value = JBBPFieldUInt .reverseBits (value );
464+ }
465+ this .onFieldUInt (obj , field , annotation , (int ) value );
466+ }
467+
468+ this .onArrayEnd (obj , field , annotation );
469+ }
470+ break ;
443471 case INT_ARRAY : {
444472 assertFieldArray (field );
445473 final int len = Array .getLength (array );
@@ -602,6 +630,20 @@ protected void onFieldInt(final Object obj, final Field field, final Bin annotat
602630
603631 }
604632
633+ /**
634+ * Notification about unsigned integer field.
635+ *
636+ * @param obj the object instance, must not be null
637+ * @param field the field, must not be null
638+ * @param annotation the annotation for field, must not be null
639+ * @param value the value of the field
640+ * @since 2.0.4
641+ */
642+ protected void onFieldUInt (final Object obj , final Field field , final Bin annotation ,
643+ final int value ) {
644+
645+ }
646+
605647 /**
606648 * Notification about float field.
607649 *
0 commit comments