adding ISelfDescriptive from validation branch
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / common / ISelfDescriptive.java
1 package eu.etaxonomy.cdm.model.common;
2
3 /**
4 * An interface especially meant to be implemented by entities that can provide a
5 * meaningful description of themselves. If an entity implements this interface, and it
6 * turns out to violate some validation constraint, the CVI will use will use the methods
7 * of this interface when saving data to the error tables, rather than defaults that might
8 * not be very intelligible to the end user. See the invidual methods for what those
9 * defaults are for entity. In fact, {@link CdmBase} implements this interface, but just
10 * returns the defaults for each method.
11 *
12 * @author ayco_holleman
13 *
14 */
15 public interface ISelfDescriptive {
16
17 /**
18 * A user-friendly description of the type of the object. Default: the simple name of
19 * the class of the object.
20 *
21 */
22 String getUserFriendlyTypeName();
23
24
25 /**
26 * A user-friendly description of the object itself. Default:
27 * {@link Object#toString()}.
28 */
29 String getUserFriendlyDescription();
30
31
32 /**
33 * A user-friendly name for the specified field (presumably a field that was found to
34 * be invalid by the CVI). Default: the returned as-is.
35 *
36 * @param fieldName
37 */
38 String getUserFriendlyFieldName(String field);
39
40 }