Package io.protostuff.runtime
Class ArrayFieldMap<T>
- java.lang.Object
-
- io.protostuff.runtime.ArrayFieldMap<T>
-
- All Implemented Interfaces:
FieldMap<T>
final class ArrayFieldMap<T> extends java.lang.Object implements FieldMap<T>
Field mapping implemented on top of java array for lookup by number. This is the most efficient implementation for almost all cases. But it should not be used when field numbers are sparse and especially when max field number is big - as this mapping internally uses array of integers with size equal to max field number. In latter caseHashFieldMapshould be used.- See Also:
HashFieldMap
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Field<T>>fieldsprivate java.util.Map<java.lang.String,Field<T>>fieldsByNameprivate Field<T>[]fieldsByNumber
-
Constructor Summary
Constructors Constructor Description ArrayFieldMap(java.util.Collection<Field<T>> fields, int lastFieldNumber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Field<T>getFieldByName(java.lang.String fieldName)Field<T>getFieldByNumber(int n)intgetFieldCount()Returns the message's total number of fields.java.util.List<Field<T>>getFields()
-
-
-
Method Detail
-
getFieldByNumber
public Field<T> getFieldByNumber(int n)
- Specified by:
getFieldByNumberin interfaceFieldMap<T>
-
getFieldByName
public Field<T> getFieldByName(java.lang.String fieldName)
- Specified by:
getFieldByNamein interfaceFieldMap<T>
-
getFieldCount
public int getFieldCount()
Returns the message's total number of fields.- Specified by:
getFieldCountin interfaceFieldMap<T>
-
-