| 1 | /* |
| 2 | * Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved. |
| 3 | * |
| 4 | * This program and the accompanying materials are made available under the |
| 5 | * terms of the Eclipse Public License v. 2.0, which is available at |
| 6 | * http://www.eclipse.org/legal/epl-2.0. |
| 7 | * |
| 8 | * This Source Code may also be made available under the following Secondary |
| 9 | * Licenses when the conditions for such availability set forth in the |
| 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, |
| 11 | * version 2 with the GNU Classpath Exception, which is available at |
| 12 | * https://www.gnu.org/software/classpath/license.html. |
| 13 | * |
| 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| 15 | */ |
| 16 | |
| 17 | package jakarta.json; |
| 18 | |
| 19 | /** |
| 20 | * An immutable JSON string value. |
| 21 | */ |
| 22 | public interface JsonString extends JsonValue { |
| 23 | |
| 24 | /** |
| 25 | * Returns the JSON string value. |
| 26 | * |
| 27 | * @return a JSON string value |
| 28 | */ |
| 29 | String getString(); |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * Returns the char sequence for the JSON String value |
| 34 | * |
| 35 | * @return a char sequence for the JSON String value |
| 36 | */ |
| 37 | CharSequence getChars(); |
| 38 | |
| 39 | /** |
| 40 | * Compares the specified object with this {@code JsonString} for equality. |
| 41 | * Returns {@code true} if and only if the specified object is also a |
| 42 | * {@code JsonString}, and their {@link #getString()} objects are |
| 43 | * <i>equal</i>. |
| 44 | * |
| 45 | * @param obj the object to be compared for equality with this |
| 46 | * {@code JsonString} |
| 47 | * @return {@code true} if the specified object is equal to this |
| 48 | * {@code JsonString} |
| 49 | */ |
| 50 | @Override |
| 51 | boolean equals(Object obj); |
| 52 | |
| 53 | /** |
| 54 | * Returns the hash code value for this {@code JsonString} object. |
| 55 | * The hash code of a {@code JsonString} object is defined to be its |
| 56 | * {@link #getString()} object's hash code. |
| 57 | * |
| 58 | * @return the hash code value for this {@code JsonString} object |
| 59 | */ |
| 60 | @Override |
| 61 | int hashCode(); |
| 62 | |
| 63 | } |