Statistics
| Revision:

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

History | View | Annotate | Download (1.13 KB)

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

    
3
import org.gvsig.tools.persistence.validation.ValidationError;
4

    
5
public class DefaultValidationError implements ValidationError {
6
        protected int errorType;
7
        protected String fieldName;
8
        protected Object value;
9

    
10
        public DefaultValidationError(String fieldName, Object value, int errorType) {
11
                this.errorType = errorType;
12
                this.fieldName = fieldName;
13
                this.value = value;
14
        }
15

    
16
        public String getFieldName() {
17
                return fieldName;
18
        }
19

    
20
        public String getInfo() {
21
                switch (errorType) {
22
                case ValidationError.WRONG_VALUE:
23
                        return "Validation error -- value: "+value.toString()+"\n does not match definition for attribute name: " + fieldName;
24
                case ValidationError.INVALID_NAME:
25
                        return "Validation error -- Attribute definition does not include the attribute name: " + fieldName;
26
                case ValidationError.MISSING_DEFINITION:
27
                        return "Validation error -- Missing attribute definition";
28
                default:
29
                        return "Unknown validation error";
30
                }
31
        }
32

    
33
        public int getType() {
34
                // TODO Auto-generated method stub
35
                return 0;
36
        }
37

    
38
        public Object getValue() {
39
                // TODO Auto-generated method stub
40
                return null;
41
        }
42

    
43
}