You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A good idea would be to use an Enum for the Filter Operator.
For example :
public static final int OP_EQUAL = 0, OP_NOT_EQUAL = 1, OP_LESS_THAN = 2,
OP_GREATER_THAN = 3, OP_LESS_OR_EQUAL = 4,...
would be :
public enum FilterOperator {
EQUALS(0),
NOT_EQUAL(1) //... More operators
private int filterValue;
private FilterOperator(int filterValue) {
this.filterValue = filterValue;
}
public int getFilterValue() {
return filterValue;
}
}
For the first step, you could simply add this enum and provide a method to
construct filter from the enum (which calls
setOperator(enumFilter.getFilterValue())) and continue to use int in the
SearchProcessor, but, IMO the design will be better with an enum :)
Thanks
Original issue reported on code.google.com by mathieu....@gmail.com on 26 Aug 2009 at 1:07
The text was updated successfully, but these errors were encountered:
Sorry for the flood, i'm currently refactoring my code, and I realize that an
other
Enum for the sort order instead of a boolean would be easier to use.
Original comment by mathieu....@gmail.com on 26 Aug 2009 at 1:55
That sounds like it could be a good idea. We'll have to take some time to
consider
the implications for interactions with other languages like Flex, JavaScript.
But it
will probably work out just fine.
I'd like to see an example of how an Enum for sort order would be easier than a
boolean. A concrete example would make it easier to evaluate the alternatives.
Original comment by dwolvert on 1 Oct 2009 at 11:58
In the example Mathieu provided you will preserve the original int value, which
will allow the use of this enum in other systems that will not allow enums. We
could also add a helper method inside the enum to convert the original int to
the enum.
Original comment by terciofi...@gmail.com on 26 Oct 2011 at 6:50
Original issue reported on code.google.com by
mathieu....@gmail.com
on 26 Aug 2009 at 1:07The text was updated successfully, but these errors were encountered: