private void convertAttribute( SubDocument.Builder builder, String columnName, Object jsonValue, SubDocType subDocType) { String attName = getAttributeName(columnName); if (attName != null) { // it is an attribute SubDocAttribute attribute = subDocType.getAttribute(attName); Value subDocValue = ValueToJsonConverterProvider.getInstance() .getConverter(attribute.getType()) .toValue(jsonValue); builder.add(attribute, subDocValue); } else { // it is a special field if (columnName.equals(SubDocTable.DID_COLUMN_NAME)) { builder.setDocumentId((Integer) jsonValue); } else if (columnName.equals(SubDocTable.INDEX_COLUMN_NAME)) { Integer index; if (jsonValue == null) { index = 0; } else { index = (Integer) jsonValue; } builder.setIndex(index); } else { throw new IllegalArgumentException( "The given record contains the attribute " + columnName + " which is not recognized"); } } }