001package org.hl7.fhir.utilities.json.model;
002
003import org.hl7.fhir.utilities.Utilities;
004
005public class JsonString extends JsonPrimitive {
006  private String value;
007
008  public JsonString(String value) {
009    super();
010    this.value = value;
011  }
012
013  private JsonString() {
014  }
015
016  public JsonElementType type() {
017    return JsonElementType.STRING;
018  }
019
020  @Override
021  public String getValue() {
022    return value;
023  }
024
025  public void setValue(String value) {
026    this.value = value;
027  }
028
029  @Override
030  public String toString() {
031    return "\""+ Utilities.escapeJson(value)+"\"";
032  }
033
034  @Override
035  public String toJson() {
036    return "\""+ Utilities.escapeJson(value)+"\"";
037  }
038  
039  @Override
040  protected JsonElement copy(JsonElement other) {
041    value = ((JsonString) other).value;
042    return this;
043  }
044  
045  @Override
046  protected JsonElement make() {
047    return new JsonString();
048  }
049}