- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {StringBuilder s =
new StringBuilder()
new StringBuilder(32)
String str;new StringBuilder(str)
- Smart code suggestions by Codota
}
protected static void writeCommentEntity(Comment entity, JsonGenerator jg) throws IOException { jg.writeStringField(COMMENT_ID_FIELD, entity.getId()); jg.writeStringField(COMMENT_PARENT_ID_FIELD, entity.getParentId()); jg.writeArrayFieldStart(COMMENT_ANCESTOR_IDS_FIELD); for (String ancestorId : entity.getAncestorIds()) { jg.writeString(ancestorId); } jg.writeEndArray(); jg.writeStringField(COMMENT_AUTHOR_FIELD, entity.getAuthor()); jg.writeStringField(COMMENT_TEXT_FIELD, entity.getText()); String creationDate = entity.getCreationDate() != null ? entity.getCreationDate().toString() : null; jg.writeStringField(COMMENT_CREATION_DATE_FIELD, creationDate); String modificationDate = entity.getModificationDate() != null ? entity.getModificationDate().toString() : null; jg.writeStringField(COMMENT_MODIFICATION_DATE_FIELD, modificationDate); if (entity instanceof ExternalEntity) { jg.writeStringField(EXTERNAL_ENTITY_ID, ((ExternalEntity) entity).getEntityId()); jg.writeStringField(EXTERNAL_ENTITY_ORIGIN, ((ExternalEntity) entity).getOrigin()); jg.writeStringField(EXTERNAL_ENTITY, ((ExternalEntity) entity).getEntity()); } }
public static void commentToDocumentModel(Comment comment, DocumentModel documentModel) { // Do not set ancestor ids as it is computed at document creation documentModel.setPropertyValue(COMMENT_AUTHOR, comment.getAuthor()); documentModel.setPropertyValue(COMMENT_TEXT, comment.getText()); documentModel.setPropertyValue(COMMENT_PARENT_ID, comment.getParentId()); Instant creationDate = comment.getCreationDate(); if (creationDate != null) { documentModel.setPropertyValue(COMMENT_CREATION_DATE, GregorianCalendar.from(ZonedDateTime.ofInstant(creationDate, ZoneId.systemDefault()))); } Instant modificationDate = comment.getModificationDate(); if (modificationDate != null) { documentModel.setPropertyValue(COMMENT_MODIFICATION_DATE, GregorianCalendar.from(ZonedDateTime.ofInstant(modificationDate, ZoneId.systemDefault()))); } }