001package org.hl7.fhir.utilities.json.model;
002
003public class JsonProperty {
004  private String name;
005  private JsonElement value;
006  private int nameHash; // for faster name comparison
007  
008  boolean noComma; // parse in Json5 mode, but records this so the validator can complain
009  boolean unquotedName;
010  boolean unquotedValue;
011   
012  private int tag;
013  
014  public JsonProperty(String name, JsonElement value) {
015    super();
016    this.name = name;
017    this.nameHash = name.hashCode();
018    this.value = value;
019  }
020
021  public String getName() {
022    return name;
023  }
024
025  public JsonElement getValue() {
026    return value;
027  }
028
029  public void setValue(JsonElement value) {
030    this.value = value;
031  }
032
033  public boolean isNoComma() {
034    return noComma;
035  }
036
037  public void setNoComma(boolean noComma) {
038    this.noComma = noComma;
039  }
040
041  public boolean isUnquotedName() {
042    return unquotedName;
043  }
044
045  public void setUnquotedName(boolean unquotedName) {
046    this.unquotedName = unquotedName;
047  }
048
049  public boolean isUnquotedValue() {
050    return unquotedValue;
051  }
052
053  public void setUnquotedValue(boolean unquotedValue) {
054    this.unquotedValue = unquotedValue;
055  }
056
057  @Override
058  public String toString() {
059    return "\""+name+"\" : "+value.toString();
060  }
061
062  public int getTag() {
063    return tag;
064  }
065
066  public void setTag(int tag) {
067    this.tag = tag;
068  }
069
070  public int getNameHash() {
071    return nameHash;
072  }
073
074}