77import java .util .Map ;
88import java .util .concurrent .ThreadLocalRandom ;
99
10+ import javax .annotation .Nullable ;
11+ import javax .annotation .Nonnull ;
12+
1013import com .google .gson .JsonArray ;
1114import com .google .gson .JsonElement ;
1215import com .google .gson .JsonObject ;
@@ -30,7 +33,7 @@ public class MSBatchRequestContent {
3033 *
3134 * @param batchRequestStepsArray List of batch steps for batching
3235 */
33- public MSBatchRequestContent (final List <MSBatchRequestStep > batchRequestStepsArray ) {
36+ public MSBatchRequestContent (@ Nonnull final List <MSBatchRequestStep > batchRequestStepsArray ) {
3437 if (batchRequestStepsArray .size () > MAX_NUMBER_OF_REQUESTS )
3538 throw new IllegalArgumentException ("Number of batch request steps cannot exceed " + MAX_NUMBER_OF_REQUESTS );
3639
@@ -52,7 +55,7 @@ public MSBatchRequestContent() {
5255 * @return true or false based on addition or no addition of batch request step
5356 * given
5457 */
55- public boolean addBatchRequestStep (final MSBatchRequestStep batchRequestStep ) {
58+ public boolean addBatchRequestStep (@ Nonnull final MSBatchRequestStep batchRequestStep ) {
5659 if (batchRequestStepsHashMap .containsKey (batchRequestStep .getRequestId ()) ||
5760 batchRequestStepsHashMap .size () >= MAX_NUMBER_OF_REQUESTS )
5861 return false ;
@@ -66,7 +69,8 @@ public boolean addBatchRequestStep(final MSBatchRequestStep batchRequestStep) {
6669 * @param arrayOfDependsOnIds ids of steps this step depends on
6770 * @return the step id
6871 */
69- public String addBatchRequestStep (final Request request , final String ... arrayOfDependsOnIds ) {
72+ @ Nonnull
73+ public String addBatchRequestStep (@ Nonnull final Request request , @ Nullable final String ... arrayOfDependsOnIds ) {
7074 String requestId ;
7175 do {
7276 requestId = Integer .toString (ThreadLocalRandom .current ().nextInt (1 , Integer .MAX_VALUE ));
@@ -83,7 +87,7 @@ public String addBatchRequestStep(final Request request, final String... arrayOf
8387 * @return true or false based on removal or no removal of batch request step
8488 * with given id
8589 */
86- public boolean removeBatchRequestStepWithId (final String requestId ) {
90+ public boolean removeBatchRequestStepWithId (@ Nonnull final String requestId ) {
8791 boolean removed = false ;
8892 if (batchRequestStepsHashMap .containsKey (requestId )) {
8993 batchRequestStepsHashMap .remove (requestId );
@@ -101,6 +105,7 @@ public boolean removeBatchRequestStepWithId(final String requestId) {
101105 /*
102106 * @return Batch request content's json as String
103107 */
108+ @ Nonnull
104109 public String getBatchRequestContent () {
105110 final JsonObject batchRequestContentMap = new JsonObject ();
106111 final JsonArray batchContentArray = new JsonArray ();
0 commit comments