DtoHelper

public final class DtoHelper

Utility class for managing dto collections.

Methods

asFieldMapById

public static Map<Long, FieldDto> asFieldMapById(Collection<FieldDto> fields)

Stores fields in a map using id as the key for faster lookup

Parameters:
  • fields – the field collection
Returns:

a map with field ids being the keys and fields being the values

asFieldMapByName

public static Map<String, FieldDto> asFieldMapByName(Collection<FieldDto> fields)

Stores fields in a map using name as the key for faster lookup

Parameters:
  • fields – the field collection
Returns:

a map with field names being the keys and fields being the values

findById

public static FieldDto findById(Collection<FieldDto> fields, Long id)

Looks through a collection of fields, in order to find a field of given id.

Parameters:
  • fields – the field collection
  • id – id of the field to find
Returns:

field of the given id or null, if field of given id was not found

findByName

public static FieldDto findByName(Collection<FieldDto> fields, String name)

Looks through a collection of fields, in order to find a field of given name.

Parameters:
  • fields – the field collection
  • name – name of the field to find
Returns:

field of the given name or null, if field of given name was not found