}
@Override
public E mapToEntity(Result result) {
boolean allNull = true;
PartitionKey partitionKey;
if (keySerDe == null) {
partitionKey = null;
} else {
partitionKey = keySerDe.deserialize(result.getRow());
}
EntityComposer.Builder<E> builder = getEntityComposer().getBuilder();
for (FieldMapping fieldMapping : entitySchema.getColumnMappingDescriptor()
.getFieldMappings()) {
Object fieldValue;
if (fieldMapping.getMappingType() == MappingType.KEY) {
if (partitionKey != null) {
// KEY field mappings are always associated with identity mappers,
// which is enforced by the DatasetDescriptor. Get the value from the
// key at the correct position.
fieldValue = partitionKey.get(
keySchema.position(fieldMapping.getFieldName()));
} else {
// This should never happen. The partitionKey is null only when
// a keySerDe hasn't been set, which indicates we have an entity
// without a key. That means there should be no KEY mapping types, but