Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libTools / src / org / gvsig / tools / persistence / validation / ValidationError.java @ 28076

History | View | Annotate | Download (1.87 KB)

1
package org.gvsig.tools.persistence.validation;
2

    
3
/**
4
 * <p>Encapsulates a validation error and allows to query
5
 * it.</p>.
6
 *
7
 * @see ValidationResult
8
 * @see org.gvsig.tools.dynobject.DynStruct
9
 * @see org.gvsig.tools.persistence.PersistenceManager
10
 *
11
 * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
12
 * @author IVER T.I. <http://www.iver.es>
13
 */
14
public interface ValidationError {
15

    
16
        /**
17
         * <p>Validation error: The specified attribute name does not exist in the
18
         * DynStruct definition.</p>
19
         */
20
        public final int INVALID_NAME = 0;
21
        /**
22
         * <p>Validation error: The name of the attribute is correct, but the type
23
         * of the assigned value does not match in the DynStruct definition.
24
         */
25
        public final int WRONG_VALUE = 1;
26

    
27
        /**
28
         * <p>Validation error: The definition of the persisted object was not registered
29
         * so it was not possible to validate it.</p>
30
         */
31
        public final int MISSING_DEFINITION = 2;
32

    
33
        /**
34
         * <p>Gets the kind of error. Possible values include: ValidationError.INVALID_NAME,
35
         * ValidationError.WRONG_VALUE and ValidationError.MISSING_DEFINITION.</p>
36
         *
37
         * @return ValidationError.INVALID_NAME, ValidationError.WRONG_VALUE or MISSING_DEFINITION
38
         * @see ValidationError.INVALID_NAME
39
         * @see ValidationError.WRONG_VALUE
40
         * @see ValidationError.MISSING_DEFINITION
41
         */
42
        public int getType();
43

    
44
        /**
45
         * <p>Gets the name of the attribute which failed the validation.</p>.
46
         *
47
         * @return The name of the field which failed the validation.
48
         */
49
        public String getFieldName();
50

    
51
        /**
52
         * <p>Gets the value of the attribute which failed the validation.</p>
53
         *
54
         * @return
55
         */
56
        public Object getValue();
57

    
58
        /**
59
         * <p>Gets a textual report of the error. Normally, this should include
60
         * information about the type of error, the name of the involved attribute
61
         * and its assigned value.</p>
62
         *
63
         * @return A plain explanation of the error.
64
         */
65
        public String getInfo();
66
}