Skip to content

Multi-Value Query Overrides #52

Open
@ajohnstonTE

Description

@ajohnstonTE

In the Query class, you can override values via the Query#put methods. However, Query#getStrings and the other multi-value methods do not use the override map. They can't really, because the override field is a Map<String, String>. This means that if you were to use a transformative validator, for example Lowercase, then the result of Query#getStrings is unaffected. This is inconsistent with the behavior you'd expect from that validator as well as the result/behavior you'd get from calling Query#get instead.

On the note of the override field, I think that it should instead be a Map<String, List<String>, so in the case of single-valued keys it would be a singleton list. Then add another Query#put method that accepts an array of strings (as well as ones accepting ints, longs, and booleans, though the only critical one is the array of strings).

This could become tricky with regards to InputTransformer. But to keep it simple, it should just use getStrings every time, then have the transformation process be performed on each element in the list individually so that it can then set the override to the transformed list as a whole. This way it avoids the need to change any transformative validators. If someone wants to transform whole lists of values as a group, that's fine and they can still do that as a custom class, but InputTransformer would simply be a class for transforming each matching value, not each collective set of values.

See:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions