class SearchFilterFactory {

    public SearchFilter getFilter(String filter) throws EntitlementException {
        Object[] parts = parseFilter(filter);
        String name = (String) parts[0];
        SearchFilter.Operator operator = (SearchFilter.Operator) parts[1];
        String value = (String) parts[2];

        if (isAttributeNumeric(name)) { // The < and > operators only apply to numeric attributes
            try {
                return new SearchFilter(getSearchAttribute(name), Long.parseLong(value), operator);
            } catch (NumberFormatException e) {
                throw new EntitlementException(
                        INVALID_SEARCH_FILTER,
                        new Object[]{"Invalid value for attribute", name, value});
            }
        } else { // Everything else is assumed to be equals.
            return new SearchFilter(getSearchAttribute(name), value);
        }
    }

    public  SearchFilterFactory();

}