I am struggling with how best to approach a complex filtering system.
The idea is to let the user define a filter on certain objects and then to search/send notifications based on that filter.
The objects are of the same archetype and but can have different fields between them and some fields can have a set of predetermined values that are allowed.
Just as an example: A filter that can be of type PC or type Laptop, some fields are similar (like os and price range) and some are not (like inch for a laptop).
The filters also need to be saved inside a JSON-type database.
To maintain the set of fields we thought about creating a Conventions class with a hierarchy of static classes that each hold final static int values each corresponding to a certain field and their possible corresponding values as integers (basically a static dictionary).
To save this kind of filter object we thought of using JSON, and ultimately.
The solution seems kinda clunky however and messy to implement or maintain so I've been wondering if there's any clever design pattern to tackle this issue in java.
Aucun commentaire:
Enregistrer un commentaire