protected Object checkAndConvertAssignment(String localName, Object value, QueryProfileRegistry registry) {
        if (type == null) return value; // no type checking

        FieldDescription fieldDescription = type.getField(localName);
        if (fieldDescription == null) {
            if (type.isStrict())
                throw new IllegalInputException("'" + localName + "' is not declared in " + type + ", and the type is strict");
            return value;
        }

        if (registry == null && (fieldDescription.getType() instanceof QueryProfileFieldType))
            throw new IllegalInputException("A registry was not passed: Query profile references is not supported");
        Object convertedValue = fieldDescription.getType().convertFrom(value, registry);
        if (convertedValue == null)
            throw new IllegalInputException("'" + value + "' is not a " + fieldDescription.getType().toInstanceDescription());
        return convertedValue;
    }
Converts to the type of the receiving field, if possible and necessary.

@return the value to be assigned: the original or a converted value
@throws IllegalArgumentException if the assignment is illegal
container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java