Search in sources :

Example 11 with IntegerArray

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);
}
Also used : SuccessStatusesSchema(com.linkedin.restli.restspec.SuccessStatusesSchema) IntegerArray(com.linkedin.data.template.IntegerArray)

Aggregations

IntegerArray (com.linkedin.data.template.IntegerArray)11 Test (org.testng.annotations.Test)10 DoubleArray (com.linkedin.data.template.DoubleArray)3 IntegerMap (com.linkedin.data.template.IntegerMap)3 Simple (com.linkedin.pegasus.generator.test.idl.records.Simple)3 CustomInt (com.linkedin.pegasus.generator.test.pdl.fixtures.CustomInt)3 BooleanArray (com.linkedin.data.template.BooleanArray)2 BytesArray (com.linkedin.data.template.BytesArray)2 FloatArray (com.linkedin.data.template.FloatArray)2 LongArray (com.linkedin.data.template.LongArray)2 StringArray (com.linkedin.data.template.StringArray)2 ByteString (com.linkedin.data.ByteString)1 DataMap (com.linkedin.data.DataMap)1 ArrayDataSchema (com.linkedin.data.schema.ArrayDataSchema)1 RecordDataSchema (com.linkedin.data.schema.RecordDataSchema)1 StringMap (com.linkedin.data.template.StringMap)1 TestDataTemplateUtil (com.linkedin.data.template.TestDataTemplateUtil)1 ArrayTest (com.linkedin.pegasus.generator.test.ArrayTest)1 EnumFruitsArray (com.linkedin.pegasus.generator.test.EnumFruitsArray)1 FixedMD5 (com.linkedin.pegasus.generator.test.FixedMD5)1