public Field removeField(String name) {
        if (isRegistered()) {
            throw new IllegalStateException("You cannot remove fields from a document type that is already registered.");
        }
        Field field = contentStructType.removeField(name);
        if (field == null) {
            for (DocumentType inheritedType : inherits) {
                field = inheritedType.removeField(name);
                if (field != null) break;
            }
        }
        return field;
    }
Removes an field from the DocumentType.

@param name The name of the field.
@return The field that was removed or null if it did not exist.
document/src/main/java/com/yahoo/document/DocumentType.java