Package io.protostuff.runtime
Class HashFieldMap<T>
- java.lang.Object
-
- io.protostuff.runtime.HashFieldMap<T>
-
- All Implemented Interfaces:
FieldMap<T>
final class HashFieldMap<T> extends java.lang.Object implements FieldMap<T>
Field mapping implemented on top of hash for field lookup by number. This is the less efficient thanArrayFieldMapfor almost all cases. But in case when field numbers are sparse and especially when max field number is big - this mapping should be used.- See Also:
ArrayFieldMap
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classHashFieldMap.FieldComparator
-
Field Summary
Fields Modifier and Type Field Description private static HashFieldMap.FieldComparatorFIELD_COMPARATORprivate java.util.List<Field<T>>fieldsprivate java.util.Map<java.lang.String,Field<T>>fieldsByNameprivate java.util.Map<java.lang.Integer,Field<T>>fieldsByNumber
-
Constructor Summary
Constructors Constructor Description HashFieldMap(java.util.Collection<Field<T>> fields)
-
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()java.util.List<Field<T>>getFields()
-
-
-
Field Detail
-
FIELD_COMPARATOR
private static final HashFieldMap.FieldComparator FIELD_COMPARATOR
-
-
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()
- Specified by:
getFieldCountin interfaceFieldMap<T>
-
-