package com.linkedin.restli.examples.greetings.client;
import java.util.EnumSet;
import java.util.HashMap;
import javax.annotation.Generated;
import com.linkedin.data.template.DynamicRecordMetadata;
import com.linkedin.restli.client.OptionsRequestBuilder;
import com.linkedin.restli.client.RestliRequestOptions;
import com.linkedin.restli.common.ResourceMethod;
import com.linkedin.restli.common.ResourceSpec;
import com.linkedin.restli.common.ResourceSpecImpl;
import com.linkedin.restli.examples.greetings.api.Greeting;
import com.linkedin.restli.internal.common.URIParamUtils;
/**
* generated from: com.linkedin.restli.examples.greetings.server.ExceptionsResource
*
*/
@Generated(value = "com.linkedin.pegasus.generator.JavaCodeUtil", comments = "Rest.li Request Builder. Generated from /Users/jodzga/dev/pegasus_trunk/pegasus/restli-int-test-api/src/main/idl/com.linkedin.restli.examples.greetings.client.exceptions.restspec.json.", date = "Thu Mar 31 14:16:21 PDT 2016")
public class ExceptionsBuilders {
private final String _baseUriTemplate;
private RestliRequestOptions _requestOptions;
private final static String ORIGINAL_RESOURCE_PATH = "exceptions";
private final static ResourceSpec _resourceSpec;
static {
HashMap<String, DynamicRecordMetadata> requestMetadataMap = new HashMap<String, DynamicRecordMetadata>();
HashMap<String, DynamicRecordMetadata> responseMetadataMap = new HashMap<String, DynamicRecordMetadata>();
HashMap<String, com.linkedin.restli.common.CompoundKey.TypeInfo> keyParts = new HashMap<String, com.linkedin.restli.common.CompoundKey.TypeInfo>();
_resourceSpec = new ResourceSpecImpl(EnumSet.of(ResourceMethod.GET, ResourceMethod.CREATE, ResourceMethod.BATCH_CREATE), requestMetadataMap, responseMetadataMap, Long.class, null, null, Greeting.class, keyParts);
}
public ExceptionsBuilders() {
this(RestliRequestOptions.DEFAULT_OPTIONS);
}
public ExceptionsBuilders(RestliRequestOptions requestOptions) {
_baseUriTemplate = ORIGINAL_RESOURCE_PATH;
_requestOptions = assignRequestOptions(requestOptions);
}
public ExceptionsBuilders(String primaryResourceName) {
this(primaryResourceName, RestliRequestOptions.DEFAULT_OPTIONS);
}
public ExceptionsBuilders(String primaryResourceName, RestliRequestOptions requestOptions) {
_baseUriTemplate = primaryResourceName;
_requestOptions = assignRequestOptions(requestOptions);
}
private String getBaseUriTemplate() {
return _baseUriTemplate;
}
public RestliRequestOptions getRequestOptions() {
return _requestOptions;
}
public String[] getPathComponents() {
return URIParamUtils.extractPathComponentsFromUriTemplate(_baseUriTemplate);
}
private static RestliRequestOptions assignRequestOptions(RestliRequestOptions requestOptions) {
if (requestOptions == null) {
return RestliRequestOptions.DEFAULT_OPTIONS;
} else {
return requestOptions;
}
}
public static String getPrimaryResource() {
return ORIGINAL_RESOURCE_PATH;
}
public OptionsRequestBuilder options() {
return new OptionsRequestBuilder(getBaseUriTemplate(), getRequestOptions());
}
/**
* For a batch create request, responds with an error for requests to create insulting greetings, responds
* with 201 created for all other requests.
*
* @return
* builder for the resource method
*/
public ExceptionsBatchCreateBuilder batchCreate() {
return new ExceptionsBatchCreateBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions());
}
/**
* Responds with an error for requests to create insulting greetings, responds
* with 201 created for all other requests.
*
* @return
* builder for the resource method
*/
public ExceptionsCreateBuilder create() {
return new ExceptionsCreateBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions());
}
public ExceptionsGetBuilder get() {
return new ExceptionsGetBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions());
}
}