well, the Filter spec defines the xml encoding for the productions of the Common Query Language whose BNF is defined in the Catalog impl spec.
There, literals are defined to be one of number, character string, datetime, boolean or geometry.
So we lack at least Boolean and Date.
Point it what to do when you have an attribute type that is not of one of those types, say, Locale. We can easily say that you have to use a kind of string canonical form for it, so you can encode a locale property as "en_US".
Problem arised when you parsed a comparison filter and has to compare an AttributeExpression against a "normalized" literal, like in the case of Locale, but the literal is actually a String. Or evel worst, a function expression whose result if a Locale against a literal which is a String.
As the possible types of the "normalized" literals are endless, it doesn't seems like an optimal solution to have a predefined set of comparison rules for objects of different types, similar to what we have in AttributeType.parse(Object). And we cannot use AttributeType.parse() inside ComparisonFilter since most of the time we'll don't have an AttributeExpression, or well the AttributeExpression will not have a reference to the AttributeType.
So I would like to propose the use of commons-beanUtils' Converter framework to deal with this situation.
ConvertUtils allows to register a Converter, used to convert String literals to instances of a given Class:
There are a number of predefined converters for the most common cases, like URL, Long, Double, etc.
This way, I could register a custom LocaleConverter and then I will be happy.