Search in sources :

Example 21 with DynamicRecordMetadata

use of com.linkedin.data.template.DynamicRecordMetadata in project rest.li by linkedin.

the class ExampleRequestResponseGenerator method buildActionResult.

private ActionResult<?> buildActionResult(ActionSchema actionSchema) {
    DynamicRecordMetadata returnsMetadata = _resourceSpec.getActionResponseMetadata(actionSchema.getName());
    if (actionSchema.hasReturns()) {
        FieldDef<?> fieldDef = returnsMetadata.getFieldDef("value");
        Object returnValue = generateFieldDefValue(fieldDef);
        return new ActionResult<>(returnValue);
    } else {
        return null;
    }
}
Also used : DynamicRecordMetadata(com.linkedin.data.template.DynamicRecordMetadata) ActionResult(com.linkedin.restli.server.ActionResult)

Aggregations

DynamicRecordMetadata (com.linkedin.data.template.DynamicRecordMetadata)21 ResourceSpecImpl (com.linkedin.restli.common.ResourceSpecImpl)14 TestRecord (com.linkedin.restli.client.test.TestRecord)13 Test (org.testng.annotations.Test)13 ResourceMethod (com.linkedin.restli.common.ResourceMethod)10 FieldDef (com.linkedin.data.template.FieldDef)6 HashMap (java.util.HashMap)6 ByteString (com.linkedin.data.ByteString)5 ResourceSpec (com.linkedin.restli.common.ResourceSpec)4 CompoundKey (com.linkedin.restli.common.CompoundKey)3 ActionSchema (com.linkedin.restli.restspec.ActionSchema)3 ArrayList (java.util.ArrayList)3 DataSchema (com.linkedin.data.schema.DataSchema)2 EnumDataSchema (com.linkedin.data.schema.EnumDataSchema)2 TyperefDataSchema (com.linkedin.data.schema.TyperefDataSchema)2 DynamicRecordTemplate (com.linkedin.data.template.DynamicRecordTemplate)2 ParameterSchema (com.linkedin.restli.restspec.ParameterSchema)2 DataMap (com.linkedin.data.DataMap)1 ActionRequestBuilder (com.linkedin.restli.client.ActionRequestBuilder)1 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)1