Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / dynobject / AbstractDynMethod.java @ 1405

History | View | Annotate | Download (1.13 KB)

1

    
2
package org.gvsig.tools.dynobject;
3

    
4
import org.apache.commons.lang3.StringUtils;
5
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
6

    
7

    
8
public abstract class AbstractDynMethod implements DynMethod {
9
    private final String name;
10
    private final String description;
11
    private int code;
12

    
13
    protected AbstractDynMethod(String name, String description) {
14
        this.name = name;
15
        if( StringUtils.isEmpty(description) ) {
16
            this.description = this.name;
17
        } else {
18
            this.description = description;
19
        }
20
        this.code = -1;
21
    }
22

    
23
    protected AbstractDynMethod(String name) {
24
        this(name, "");
25
    }
26
    
27
    @Override
28
    public String getName() {
29
        return this.name;
30
    }
31
    
32
    @Override
33
    public String getDescription() {
34
        return this.description;
35
    }
36

    
37
    public void setCode(int code) {
38
        this.code = code;
39
    }
40
    
41
    @Override
42
    public int getCode() throws DynMethodNotSupportedException {
43
        return this.code;
44
    }
45

    
46
    @Override
47
    public Object clone() throws CloneNotSupportedException {
48
        return super.clone(); 
49
    }
50
    
51
}