use of com.linkedin.data.template.IntegerArray in project rest.li by linkedin.
the class ResourceModelEncoder method appendSuccessStatuses.
/**
* Given a resource method schema, adds the specified success status codes.
*
* @param schema specific resource method schema
* @param successStatuses list of success status codes to add to this schema
*/
private void appendSuccessStatuses(final RecordTemplate schema, final List<HttpStatus> successStatuses) {
if (successStatuses == null || successStatuses.isEmpty()) {
return;
}
// Wrap the underlying data map in the shared schema interface
SuccessStatusesSchema successStatusesSchema = new SuccessStatusesSchema(schema.data());
IntegerArray statuses = successStatuses.stream().map(HttpStatus::getCode).collect(Collectors.toCollection(IntegerArray::new));
successStatusesSchema.setSuccess(statuses);
}
Aggregations