Changeset 13231 in josm for trunk/src/javax/json/JsonArrayBuilder.java
- Timestamp:
- 2017-12-23T02:40:43+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/javax/json/JsonArrayBuilder.java
r6756 r13231 2 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 3 * 4 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.4 * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved. 5 5 * 6 6 * The contents of this file are subject to the terms of either the GNU … … 9 9 * may not use this file except in compliance with the License. You can 10 10 * obtain a copy of the License at 11 * https:// glassfish.dev.java.net/public/CDDL+GPL_1_1.html12 * or packager/legal/LICENSE.txt. See the License for the specific11 * https://oss.oracle.com/licenses/CDDL+GPL-1.1 12 * or LICENSE.txt. See the License for the specific 13 13 * language governing permissions and limitations under the License. 14 14 * 15 15 * When distributing the software, include this License Header Notice in each 16 * file and include the License file at packager/legal/LICENSE.txt.16 * file and include the License file at LICENSE.txt. 17 17 * 18 18 * GPL Classpath Exception: … … 45 45 46 46 /** 47 * A builder for creating {@link JsonArray} models from scratch. This 48 * interface initializes an empty JSON array model and provides methods to add 49 * values to the array model and to return the resulting array. The methods 50 * in this class can be chained to add multiple values to the array. 47 * A builder for creating {@link JsonArray} models from scratch, and for 48 * modifying a existing {@code JsonArray}. 49 * <p>A {@code JsonArrayBuilder} can start with an empty or a non-empty 50 * JSON array model. This interface provides methods to add, insert, remove 51 * and replace values in the JSON array model.</p> 52 * <p>Methods in this class can be chained to perform multiple values to 53 * the array.</p> 51 54 * 52 55 * <p>The class {@link javax.json.Json} contains methods to create the builder … … 64 67 * way to create multiple instances. 65 68 * 66 * <a id="JsonArrayBuilderExample1"/>67 69 * The example code below shows how to build a {@code JsonArray} object 68 70 * that represents the following JSON array: … … 165 167 * @param value the number value 166 168 * @return this array builder 167 * @throws NumberFormatException if the value is Not-a-Number (NaN) or169 * @throws NumberFormatException if the value is Not-a-Number (NaN) or 168 170 * infinity 169 171 * … … 207 209 208 210 /** 211 * Adds all elements of the array in the specified array builder to the array. 212 * 213 * @param builder the array builder 214 * @return this array builder 215 * @throws NullPointerException if the specified builder is null 216 * 217 @since 1.1 218 */ 219 default JsonArrayBuilder addAll(JsonArrayBuilder builder) { 220 throw new UnsupportedOperationException(); 221 } 222 223 /** 224 * Inserts a value to the array at the specified position. Shifts the value 225 * currently at that position (if any) and any subsequent values to the right 226 * (adds one to their indices). Index starts with 0. 227 * 228 * @param index the position in the array 229 * @param value the JSON value 230 * @return this array builder 231 * @throws NullPointerException if the specified value is null 232 * @throws IndexOutOfBoundsException if the index is out of range 233 * {@code (index < 0 || index > array size)} 234 * 235 * @since 1.1 236 */ 237 default JsonArrayBuilder add(int index, JsonValue value) { 238 throw new UnsupportedOperationException(); 239 } 240 241 /** 242 * Adds a value to the array as a {@link JsonString} at the specified position. 243 * Shifts the value currently at that position (if any) and any subsequent values 244 * to the right (adds one to their indices). Index starts with 0. 245 * 246 * @param index the position in the array 247 * @param value the string value 248 * @return this array builder 249 * @throws NullPointerException if the specified value is null 250 * @throws IndexOutOfBoundsException if the index is out of range 251 * {@code (index < 0 || index > array size)} 252 * 253 * @since 1.1 254 */ 255 default JsonArrayBuilder add(int index, String value) { 256 throw new UnsupportedOperationException(); 257 } 258 259 /** 260 * Adds a value to the array as a {@link JsonNumber} at the specified position. 261 * Shifts the value currently at that position (if any) and any subsequent values 262 * to the right (adds one to their indices). Index starts with 0. 263 * 264 * @param index the position in the array 265 * @param value the number value 266 * @return this array builder 267 * @throws NullPointerException if the specified value is null 268 * @throws IndexOutOfBoundsException if the index is out of range 269 * {@code (index < 0 || index > array size)} 270 * 271 * @see JsonNumber 272 * 273 * @since 1.1 274 */ 275 default JsonArrayBuilder add(int index, BigDecimal value) { 276 throw new UnsupportedOperationException(); 277 } 278 279 /** 280 * Adds a value to the array as a {@link JsonNumber} at the specified position. 281 * Shifts the value currently at that position (if any) and any subsequent values 282 * to the right (adds one to their indices). Index starts with 0. 283 * 284 * @param index the position in the array 285 * @param value the number value 286 * @return this array builder 287 * @throws NullPointerException if the specified value is null 288 * @throws IndexOutOfBoundsException if the index is out of range 289 * {@code (index < 0 || index > array size)} 290 * 291 * @see JsonNumber 292 * 293 * @since 1.1 294 */ 295 default JsonArrayBuilder add(int index, BigInteger value) { 296 throw new UnsupportedOperationException(); 297 } 298 299 /** 300 * Adds a value to the array as a {@link JsonNumber} at the specified position. 301 * Shifts the value currently at that position (if any) and any subsequent values 302 * to the right (adds one to their indices). Index starts with 0. 303 * 304 * @param index the position in the array 305 * @param value the number value 306 * @return this array builder 307 * @throws IndexOutOfBoundsException if the index is out of range 308 * {@code (index < 0 || index > array size)} 309 * 310 * @see JsonNumber 311 * 312 * @since 1.1 313 */ 314 default JsonArrayBuilder add(int index, int value) { 315 throw new UnsupportedOperationException(); 316 } 317 318 /** 319 * Adds a value to the array as a {@link JsonNumber} at the specified position. 320 * Shifts the value currently at that position (if any) and any subsequent values 321 * to the right (adds one to their indices). Index starts with 0. 322 * 323 * @param index the position in the array 324 * @param value the number value 325 * @return this array builder 326 * @throws IndexOutOfBoundsException if the index is out of range 327 * {@code (index < 0 || index > array size)} 328 * 329 * @see JsonNumber 330 * 331 * @since 1.1 332 */ 333 default JsonArrayBuilder add(int index, long value) { 334 throw new UnsupportedOperationException(); 335 } 336 337 /** 338 * Adds a value to the array as a {@link JsonNumber} at the specified position. 339 * Shifts the value currently at that position (if any) and any subsequent values 340 * to the right (adds one to their indices). Index starts with 0. 341 * 342 * @param index the position in the array 343 * @param value the number value 344 * @return this array builder 345 * @throws NumberFormatException if the value is Not-a-Number (NaN) or 346 * infinity 347 * @throws IndexOutOfBoundsException if the index is out of range 348 * {@code (index < 0 || index > array size)} 349 * 350 * @see JsonNumber 351 * 352 * @since 1.1 353 */ 354 default JsonArrayBuilder add(int index, double value) { 355 throw new UnsupportedOperationException(); 356 } 357 358 /** 359 * Adds a {@link JsonValue#TRUE} or {@link JsonValue#FALSE} value to the 360 * array at the specified position. 361 * Shifts the value currently at that position (if any) and any subsequent values 362 * to the right (adds one to their indices). Index starts with 0. 363 * 364 * @param index the position in the array 365 * @param value the boolean value 366 * @return this array builder 367 * @throws IndexOutOfBoundsException if the index is out of range 368 * {@code (index < 0 || index > array size)} 369 * 370 * @since 1.1 371 */ 372 default JsonArrayBuilder add(int index, boolean value) { 373 throw new UnsupportedOperationException(); 374 } 375 376 /** 377 * Adds a {@link JsonValue#NULL} value to the array at the specified position. 378 * Shifts the value currently at that position (if any) and any subsequent values 379 * to the right (adds one to their indices). Index starts with 0. 380 * 381 * @param index the position in the array 382 * @return this array builder 383 * @throws IndexOutOfBoundsException if the index is out of range 384 * {@code (index < 0 || index > array size)} 385 * 386 * @since 1.1 387 */ 388 default JsonArrayBuilder addNull(int index) { 389 return add(index, JsonValue.NULL); 390 } 391 392 /** 393 * Adds a {@link JsonObject} from an object builder to the array at the specified position. 394 * Shifts the value currently at that position (if any) and any subsequent values 395 * to the right (adds one to their indices). Index starts with 0. 396 * 397 * @param index the position in the array 398 * @param builder the object builder 399 * @return this array builder 400 * @throws NullPointerException if the specified builder is null 401 * @throws IndexOutOfBoundsException if the index is out of range 402 * {@code (index < 0 || index > array size)} 403 * 404 * @since 1.1 405 */ 406 default JsonArrayBuilder add(int index, JsonObjectBuilder builder) { 407 throw new UnsupportedOperationException(); 408 } 409 410 /** 411 * Adds a {@link JsonArray} from an array builder to the array at the specified position. 412 * Shifts the value currently at that position (if any) and any subsequent values 413 * to the right (adds one to their indices). Index starts with 0. 414 * 415 * @param index the position in the array 416 * @param builder the array builder 417 * @return this array builder 418 * @throws NullPointerException if the specified builder is null 419 * @throws IndexOutOfBoundsException if the index is out of range 420 * {@code (index < 0 || index > array size)} 421 * 422 * @since 1.1 423 */ 424 default JsonArrayBuilder add(int index, JsonArrayBuilder builder) { 425 throw new UnsupportedOperationException(); 426 } 427 428 /** 429 * Replaces a value in the array with the specified value at the 430 * specified position. 431 * 432 * @param index the position in the array 433 * @param value the JSON value 434 * @return this array builder 435 * @throws NullPointerException if the specified value is null 436 * @throws IndexOutOfBoundsException if the index is out of range 437 * {@code (index < 0 || index >= array size)} 438 * 439 * @since 1.1 440 */ 441 default JsonArrayBuilder set(int index, JsonValue value) { 442 throw new UnsupportedOperationException(); 443 } 444 445 /** 446 * Replaces a value in the array with the specified value as a 447 * {@link JsonString} at the specified position. 448 * 449 * @param index the position in the array 450 * @param value the string value 451 * @return this array builder 452 * @throws NullPointerException if the specified value is null 453 * @throws IndexOutOfBoundsException if the index is out of range 454 * {@code (index < 0 || index >= array size)} 455 * 456 * @since 1.1 457 */ 458 default JsonArrayBuilder set(int index, String value) { 459 throw new UnsupportedOperationException(); 460 } 461 462 /** 463 * Replaces a value in the array with the specified value as a 464 * {@link JsonNumber} at the specified position. 465 * 466 * @param index the position in the array 467 * @param value the number value 468 * @return this array builder 469 * @throws NullPointerException if the specified value is null 470 * @throws IndexOutOfBoundsException if the index is out of range 471 * {@code (index < 0 || index >= array size)} 472 * 473 * @see JsonNumber 474 * 475 * @since 1.1 476 */ 477 default JsonArrayBuilder set(int index, BigDecimal value) { 478 throw new UnsupportedOperationException(); 479 } 480 481 /** 482 * Replaces a value in the array with the specified value as a 483 * {@link JsonNumber} at the specified position. 484 * 485 * @param index the position in the array 486 * @param value the number value 487 * @return this array builder 488 * @throws NullPointerException if the specified value is null 489 * @throws IndexOutOfBoundsException if the index is out of range 490 * {@code (index < 0 || index >= array size)} 491 * 492 * @see JsonNumber 493 * 494 * @since 1.1 495 */ 496 default JsonArrayBuilder set(int index, BigInteger value) { 497 throw new UnsupportedOperationException(); 498 } 499 500 /** 501 * Replaces a value in the array with the specified value as a 502 * {@link JsonNumber} at the specified position. 503 * 504 * @param index the position in the array 505 * @param value the number value 506 * @return this array builder 507 * @throws IndexOutOfBoundsException if the index is out of range 508 * {@code (index < 0 || index >= array size)} 509 * 510 * @see JsonNumber 511 * 512 * @since 1.1 513 */ 514 default JsonArrayBuilder set(int index, int value) { 515 throw new UnsupportedOperationException(); 516 } 517 518 /** 519 * Replaces a value in the array with the specified value as a 520 * {@link JsonNumber} at the specified position. 521 * 522 * @param index the position in the array 523 * @param value the number value 524 * @return this array builder 525 * @throws IndexOutOfBoundsException if the index is out of range 526 * {@code (index < 0 || index >= array size)} 527 * 528 * @see JsonNumber 529 * 530 * @since 1.1 531 */ 532 default JsonArrayBuilder set(int index, long value) { 533 throw new UnsupportedOperationException(); 534 } 535 536 /** 537 * Replaces a value in the array with the specified value as a 538 * {@link JsonNumber} at the specified position. 539 * 540 * @param index the position in the array 541 * @param value the number value 542 * @return this array builder 543 * @throws NumberFormatException if the value is Not-a-Number (NaN) or 544 * infinity 545 * @throws IndexOutOfBoundsException if the index is out of range 546 * {@code (index < 0 || index >= array size)} 547 * 548 * @see JsonNumber 549 * 550 * @since 1.1 551 */ 552 default JsonArrayBuilder set(int index, double value) { 553 throw new UnsupportedOperationException(); 554 } 555 556 /** 557 * Replaces a value in the array with 558 * a {@link JsonValue#TRUE} or {@link JsonValue#FALSE} value 559 * at the specified position. 560 * 561 * @param index the position in the array 562 * @param value the boolean value 563 * @return this array builder 564 * @throws IndexOutOfBoundsException if the index is out of range 565 * {@code (index < 0 || index >= array size)} 566 * 567 * @since 1.1 568 */ 569 default JsonArrayBuilder set(int index, boolean value) { 570 throw new UnsupportedOperationException(); 571 } 572 573 /** 574 * Replaces a value in the array with 575 * a {@link JsonValue#NULL} value at the specified position. 576 * 577 * @param index the position in the array 578 * @return this array builder 579 * @throws IndexOutOfBoundsException if the index is out of range 580 * {@code (index < 0 || index >= array size)} 581 * 582 * @since 1.1 583 */ 584 default JsonArrayBuilder setNull(int index) { 585 return set(index, JsonValue.NULL); 586 } 587 588 /** 589 * Replaces a value in the array with the specified value as a 590 * {@link JsonObject} from an object builder at the specified position. 591 * 592 * @param index the position in the array 593 * @param builder the object builder 594 * @return this array builder 595 * @throws NullPointerException if the specified builder is null 596 * @throws IndexOutOfBoundsException if the index is out of range 597 * {@code (index < 0 || index >= array size)} 598 * 599 * @since 1.1 600 */ 601 default JsonArrayBuilder set(int index, JsonObjectBuilder builder) { 602 throw new UnsupportedOperationException(); 603 } 604 605 /** 606 * Replaces a value in the array with the specified value as a 607 * {@link JsonArray} from an array builder at the specified position. 608 * 609 * @param index the position in the array 610 * @param builder the array builder 611 * @return this array builder 612 * @throws NullPointerException if the specified builder is null 613 * @throws IndexOutOfBoundsException if the index is out of range 614 * {@code (index < 0 || index >= array size)} 615 * 616 * @since 1.1 617 */ 618 default JsonArrayBuilder set(int index, JsonArrayBuilder builder) { 619 throw new UnsupportedOperationException(); 620 } 621 622 /** 623 * Remove the value in the array at the specified position. 624 * Shift any subsequent values to the left (subtracts one from their 625 * indices. 626 * 627 * @param index the position in the array 628 * @return this array builder 629 * @throws IndexOutOfBoundsException if the index is out of range 630 * {@code (index < 0 || index >= array size)} 631 * 632 * @since 1.1 633 */ 634 default JsonArrayBuilder remove(int index) { 635 throw new UnsupportedOperationException(); 636 } 637 638 /** 209 639 * Returns the current array. 210 640 *
Note:
See TracChangeset
for help on using the changeset viewer.