@Override
    public void assign(Object o) {
        if (o == null) {
            clear();
        } else if (o instanceof ReferenceFieldValue) {
            assignFromFieldValue((ReferenceFieldValue) o);
        } else if (o instanceof DocumentId) {
            setDocumentId((DocumentId) o);
        } else {
            throw new IllegalArgumentException(String.format(
                    "Can't assign value of type '%s' to field of type '%s'. Expected value of type '%s'",
                    o.getClass().getName(), getClass().getName(), DocumentId.class.getName()));
        }
    }
Creates a reference pointing to a particular document instance in the document
type referenced by <code>referenceType</code>.

@param referenceType reference target type
@param documentId document ID of the same document type as that given by <code>referenceType</code>
@throws IllegalArgumentException if documentId is not of the expected document type
document/src/main/java/com/yahoo/document/datatypes/ReferenceFieldValue.java