| 10 | |
| 11 | |
| 12 | final class IonStringLite |
| 13 | extends IonTextLite |
| 14 | implements IonString |
| 15 | { |
| 16 | private static final int HASH_SIGNATURE = |
| 17 | IonType.STRING.toString().hashCode(); |
| 18 | |
| 19 | /** |
| 20 | * Constructs a <code>null.string</code> value. |
| 21 | */ |
| 22 | IonStringLite(ContainerlessContext context, boolean isNull) |
| 23 | { |
| 24 | super(context, isNull); |
| 25 | } |
| 26 | |
| 27 | IonStringLite(IonStringLite existing, IonContext context) |
| 28 | { |
| 29 | super(existing, context); |
| 30 | // no need to set values as these are set at the parent IonTextLite |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | IonValueLite shallowClone(IonContext parentContext) |
| 35 | { |
| 36 | return new IonStringLite(this, parentContext); |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public IonStringLite clone() |
| 41 | { |
| 42 | return (IonStringLite) shallowClone(ContainerlessContext.wrap(getSystem())); |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | int hashSignature() { |
| 47 | return HASH_SIGNATURE; |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | int scalarHashCode() |
| 52 | { |
| 53 | int result = HASH_SIGNATURE; |
| 54 | result ^= _text_value.hashCode(); |
| 55 | |
| 56 | return hashTypeAnnotations(result); |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public IonType getTypeSlow() |
| 61 | { |
| 62 | return IonType.STRING; |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | final void writeBodyTo(IonWriter writer, SymbolTableProvider symbolTableProvider) |
| 67 | throws IOException |
| 68 | { |
| 69 | writer.writeString(_text_value); |