// Read the HAL
ReadableRepresentation rr = unmarshalHal(hal);
Map<String, Object> properties = rr.getProperties();
CustomerUserDto customerUser = new CustomerUserDto();
// Mandatory properties (will cause IllegalStateException if not present)
// Optional direct properties
// Optional properties
for (Map.Entry<String, Object> entry : properties.entrySet()) {
customerUser.getOptionalProperties().put(entry.getKey(), (String) entry.getValue());
}
return Optional.of(customerUser);
}