@Override public Spelling decodeJSON(JsonNode node, boolean validate) throws DecodingException { Spelling spelling = new Spelling(); spelling.setScript(parseNillableString(node .path(AQDJSONConstants.SCRIPT))); spelling.setText(node.path(AQDJSONConstants.TEXT).textValue()); spelling.setTransliterationScheme(parseNillableString(node .path(AQDJSONConstants.TRANSLITERATION_SCHEME))); return spelling; }
@Override public boolean equals(Object obj) { if (obj instanceof Spelling) { Spelling that = (Spelling) obj; return Objects.equal(this.getText(), that.getText()) && Objects.equal(this.getScript(), that.getScript()) && Objects.equal(this.getTransliterationScheme(), that.getTransliterationScheme()); } return false; }
@Override protected void read(QName name) throws XMLStreamException, DecodingException { if (name.equals(AqdConstants.QN_GN_TEXT)) { this.spelling.setText(chars()); } else if (name.equals(AqdConstants.QN_GN_SCRIPT)) { this.spelling.setScript(delegate(new NillableStringReader())); } else if (name.equals(AqdConstants.QN_GN_TRANSLITERATION_SCHEME)) { this.spelling.setTransliterationScheme(delegate(new NillableStringReader())); } else { ignore(); } }
@Override protected void begin() { this.spelling = new Spelling(); }
public Spelling setTransliterationScheme(String transliterationScheme) { return this.setTransliterationScheme(Nillable.of(transliterationScheme)); }
public Spelling setScript(String script) { return setScript(Nillable.of(script)); }
@Override protected void read(QName name) throws XMLStreamException, DecodingException { if (name.equals(AqdConstants.QN_GN_TEXT)) { this.spelling.setText(chars()); } else if (name.equals(AqdConstants.QN_GN_SCRIPT)) { this.spelling.setScript(delegate(new NillableStringReader())); } else if (name.equals(AqdConstants.QN_GN_TRANSLITERATION_SCHEME)) { this.spelling.setTransliterationScheme(delegate(new NillableStringReader())); } else { ignore(); } }
@Override protected void begin() { this.spelling = new Spelling(); }
public Spelling setTransliterationScheme(String transliterationScheme) { return this.setTransliterationScheme(Nillable.of(transliterationScheme)); }
public Spelling setScript(String script) { return setScript(Nillable.of(script)); }
@Override public int hashCode() { return Objects.hashCode(getText(), getScript(), getTransliterationScheme()); }
public List<Spelling> getSpelling() { if (CollectionHelper.isEmpty(spelling)) { addSpelling(new Spelling()); } return Collections.unmodifiableList(spelling); }
@Override public int hashCode() { return Objects.hashCode(getText(), getScript(), getTransliterationScheme()); }
public List<Spelling> getSpelling() { if (CollectionHelper.isEmpty(spelling)) { addSpelling(new Spelling()); } return Collections.unmodifiableList(spelling); }
@Override public boolean equals(Object obj) { if (obj instanceof Spelling) { Spelling that = (Spelling) obj; return Objects.equal(this.getText(), that.getText()) && Objects.equal(this.getScript(), that.getScript()) && Objects.equal(this.getTransliterationScheme(), that.getTransliterationScheme()); } return false; }
@Override public String toString() { return MoreObjects.toStringHelper(this) .add("text", getText()) .add("script", getScript()) .add("transliterationScheme", getTransliterationScheme()) .toString(); }
@Override public String toString() { return MoreObjects.toStringHelper(this) .add("text", getText()) .add("script", getScript()) .add("transliterationScheme", getTransliterationScheme()) .toString(); }
@Override public JsonNode encodeJSON(Spelling t) throws EncodingException { ObjectNode j = nodeFactory().objectNode(); j.put(AQDJSONConstants.TEXT, t.getText()); j.set(AQDJSONConstants.SCRIPT, encodeObjectToJson(t.getScript())); j.set(AQDJSONConstants.TRANSLITERATION_SCHEME, encodeObjectToJson(t.getTransliterationScheme())); return j; }
protected void encodeSpellingOfName(Spelling spelling) throws XMLStreamException { start(AqdConstants.QN_GN_SPELLING_OF_NAME); encodeString(AqdConstants.QN_GN_TEXT, spelling.getText()); encodeNillableString(AqdConstants.QN_GN_SCRIPT, spelling.getScript()); encodeNillableString(AqdConstants.QN_GN_TRANSLITERATION_SCHEME, spelling.getTransliterationScheme()); end(AqdConstants.QN_GN_SPELLING_OF_NAME); }
protected void encodeSpellingOfName(Spelling spelling) throws XMLStreamException { start(AqdConstants.QN_GN_SPELLING_OF_NAME); encodeString(AqdConstants.QN_GN_TEXT, spelling.getText()); encodeNillableString(AqdConstants.QN_GN_SCRIPT, spelling.getScript()); encodeNillableString(AqdConstants.QN_GN_TRANSLITERATION_SCHEME, spelling.getTransliterationScheme()); end(AqdConstants.QN_GN_SPELLING_OF_NAME); }