public Field addField(String name, DataType type) {
        if (isRegistered()) {
            throw new IllegalStateException("You cannot add fields to a document type that is already registered.");
        }
        Field field = new Field(name, type);
        contentStructType.addField(field);
        return field;
    }
Adds a new field to this document type and returns the new field object

@param name The name of the field to add
@param type The datatype of the field to add
@return The field created
        TODO Fix searchdefinition so that exception can be thrown if filed is already registerd.
document/src/main/java/com/yahoo/document/DocumentType.java