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 thanArrayFieldMap
for 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 class
HashFieldMap.FieldComparator
-
Field Summary
Fields Modifier and Type Field Description private static HashFieldMap.FieldComparator
FIELD_COMPARATOR
private java.util.List<Field<T>>
fields
private java.util.Map<java.lang.String,Field<T>>
fieldsByName
private 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)
int
getFieldCount()
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:
getFieldByNumber
in interfaceFieldMap<T>
-
getFieldByName
public Field<T> getFieldByName(java.lang.String fieldName)
- Specified by:
getFieldByName
in interfaceFieldMap<T>
-
getFieldCount
public int getFieldCount()
- Specified by:
getFieldCount
in interfaceFieldMap<T>
-
-