1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.document.schema.plug;
13 /***
14 * Represents rule for textual value.
15 * @author Martin Vysny
16 */
17 public interface IValueRule {
18 /***
19 * Checks whether this textual rule can contain given value.
20 * @param value value to check.
21 * @return true if the value is valid.
22 */
23 public boolean acceptsValue(String value);
24 /***
25 * Returns human-readable name for the datatype, that is represented by this
26 * instance.
27 * @return Short displayable name (and description, if necessary) of
28 * datatype.
29 */
30 public String getDatatypeName();
31 /***
32 * Checks, whether this value rule accepts any non-empty string.
33 * @return true if this value rule accepts any non-empty string.
34 */
35 public boolean acceptsSomething();
36 /***
37 * Compose and return an error message, why given value was not accepted.
38 * @param value the value
39 * @return error message, possibly suggesting correct value whenever
40 * possible. If no error message is available then return empty string. If
41 * the value is acceptable return <code>null</code>.
42 */
43 public String getErrorMessage(String value);
44 }