01: /*
02: * ColumnComparator.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.storage.filter;
13:
14: /**
15: * @author support@sql-workbench.net
16: */
17: public interface ColumnComparator {
18: /**
19: * Return a String representation to be displayed in the UI
20: */
21: String getOperator();
22:
23: /**
24: * Evaluate this ColumnComparator.
25: * reference is the value entered by the user in the filter definition.
26: * value is the actual value against which the reference should be
27: * compared.
28: * Comparators with needsValue() == true should ignore the reference
29: * value
30: */
31: boolean evaluate(Object reference, Object value, boolean ignoreCase);
32:
33: /**
34: * Check if this comparator can be applied to the given class
35: */
36: boolean supportsType(Class valueClass);
37:
38: /**
39: * Should return true if this comparator supports the ignoreCase
40: * parameter in the {@link #evaluate(Object, Object, boolean)} method.
41: * The value returned by this method will be used when building the GUI
42: * for defining a filter.
43: */
44: boolean supportsIgnoreCase();
45:
46: /**
47: * If this filter does not need a reference value (e.g. for IS NULL)
48: * this method should return true. In that case, the reference
49: * value passed into the {@link #evaluate(Object, Object, boolean)} method
50: * has to be ignored by the filter.
51: */
52: boolean needsValue();
53:
54: String getValueExpression(Object value);
55:
56: /**
57: * Validate the input whether this comparator
58: * can actually deal with the value
59: */
60: boolean validateInput(Object input);
61:
62: boolean comparesEquality();
63: }
|