Revision 1361 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClassName.java

View differences:

DefaultDynClassName.java
24 24
package org.gvsig.tools.dynobject.impl;
25 25

  
26 26
import org.gvsig.tools.dynobject.DynClassName;
27
import org.gvsig.tools.dynobject.DynObjectManager;
27 28

  
28 29
/**
29 30
 * Default {@link DynClassName} implementation.
......
32 33
 * @version $Id$
33 34
 */
34 35
public class DefaultDynClassName implements DynClassName {
35
	private static final String SEPARATOR = ":";
36 36
	
37 37
	private String name;
38 38
	private String namespace;
......
43 43
	}
44 44
	
45 45
	public DefaultDynClassName(String fullname) {
46
		int x=fullname.indexOf(SEPARATOR);
47
		int y=fullname.lastIndexOf(SEPARATOR);
46
		int x=fullname.indexOf(DynObjectManager.DYNCLASS_NAME_SEPARATOR);
47
		int y=fullname.lastIndexOf(DynObjectManager.DYNCLASS_NAME_SEPARATOR);
48 48
		if( x>-1 ) {
49 49
			// Separator should only be present once
50 50
			if (x==y){
51 51
				setNamespace(fullname.substring(0, x));
52 52
				setName(fullname.substring(x+1));				
53 53
			}else{
54
				throw new IllegalArgumentException("Fullname '" + fullname + "' not allowed. Only one '" + SEPARATOR + "' is possible.");				
54
				throw new IllegalArgumentException("Fullname '" + fullname + "' not allowed. Only one '" + DynObjectManager.DYNCLASS_NAME_SEPARATOR + "' is possible.");				
55 55
			}
56 56
		} else {
57 57
			this.namespace = null;
......
76 76
    	if( namespace == null ) {
77 77
    		return name;
78 78
    	}
79
    	return namespace + SEPARATOR + name;
79
    	return namespace + DynObjectManager.DYNCLASS_NAME_SEPARATOR + name;
80 80
	}
81 81

  
82 82
	public void setNamespace(String namespace) {
83 83
		if(namespace!=null){
84
            if (namespace.indexOf(SEPARATOR) <= -1) {
84
            if (namespace.indexOf(DynObjectManager.DYNCLASS_NAME_SEPARATOR) <= -1) {
85 85
				this.namespace = namespace;
86 86
			}else{
87
				throw new IllegalArgumentException("Namespace '" + namespace + "' not allowed. Character " + SEPARATOR + " forbidden whithin a dynClass' namespace'");
87
				throw new IllegalArgumentException("Namespace '" + namespace + "' not allowed. Character " + DynObjectManager.DYNCLASS_NAME_SEPARATOR + " forbidden whithin a dynClass' namespace'");
88 88
			}
89 89
		}else{
90 90
			this.namespace = null;
......
93 93

  
94 94
	public void setName(String name) {
95 95
		if(name!=null){
96
            if (name.indexOf(SEPARATOR) <= -1) {
96
            if (name.indexOf(DynObjectManager.DYNCLASS_NAME_SEPARATOR) <= -1) {
97 97
				this.name = name;
98 98
			}else{
99
				throw new IllegalArgumentException("Name '" + name + "' not allowed. Character '" + SEPARATOR + "' is not valid within a dynClass' name.");
99
				throw new IllegalArgumentException("Name '" + name + "' not allowed. Character '" + DynObjectManager.DYNCLASS_NAME_SEPARATOR + "' is not valid within a dynClass' name.");
100 100
			}
101 101
		}else{
102 102
			throw new IllegalArgumentException("Null value unsupported for a dynClass' name.");

Also available in: Unified diff