public void setDataType(DataType type) { if (docId != null && docId.hasDocType() && !docId.getDocType().equals(type.getName())) { throw new IllegalArgumentException("Trying to set a document type (" + type.getName() + ") that doesn't match the document id (" + docId + ")."); } super.setDataType(type); setNewType((DocumentType)type); }