Revision 962
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java | ||
---|---|---|
29 | 29 |
public class CoerceToInt implements Coercion { |
30 | 30 |
|
31 | 31 |
public Object coerce(Object value) throws CoercionException { |
32 |
if( value == null ) { |
|
33 |
return null; |
|
34 |
} |
|
32 | 35 |
try { |
33 | 36 |
if( ! (value instanceof Integer) ) { |
34 | 37 |
if( value instanceof Number ) { |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java | ||
---|---|---|
29 | 29 |
public class CoerceToLong implements Coercion { |
30 | 30 |
|
31 | 31 |
public Object coerce(Object value) throws CoercionException { |
32 |
if( value == null ) { |
|
33 |
return null; |
|
34 |
} |
|
32 | 35 |
try { |
33 | 36 |
if( ! (value instanceof Long) ) { |
34 | 37 |
if( value instanceof Number ) { |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURI.java | ||
---|---|---|
33 | 33 |
public class CoerceToURI implements Coercion { |
34 | 34 |
|
35 | 35 |
public Object coerce(Object value) throws CoercionException { |
36 |
if( value == null ) { |
|
37 |
return null; |
|
38 |
} |
|
36 | 39 |
if( ! (value instanceof URI) ) { |
37 | 40 |
if( value instanceof String ) { |
38 | 41 |
try { |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/AbstractCoerceToDate.java | ||
---|---|---|
42 | 42 |
public abstract class AbstractCoerceToDate implements Coercion { |
43 | 43 |
|
44 | 44 |
public Object coerce(Object value) throws CoercionException { |
45 |
if( value == null ) { |
|
46 |
return null; |
|
47 |
} |
|
45 | 48 |
if (!(value instanceof Date)) { |
46 | 49 |
DateFormat dateFormatter = createFormatter(); |
47 | 50 |
String valueStr = value.toString(); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURL.java | ||
---|---|---|
33 | 33 |
public class CoerceToURL implements Coercion { |
34 | 34 |
|
35 | 35 |
public Object coerce(Object value) throws CoercionException { |
36 |
if( value == null ) { |
|
37 |
return null; |
|
38 |
} |
|
36 | 39 |
if( ! (value instanceof URL) ) { |
37 | 40 |
if( value instanceof String ) { |
38 | 41 |
try { |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java | ||
---|---|---|
29 | 29 |
public class CoerceToByte implements Coercion { |
30 | 30 |
|
31 | 31 |
public Object coerce(Object value) throws CoercionException { |
32 |
if( value == null ) { |
|
33 |
return null; |
|
34 |
} |
|
35 |
|
|
32 | 36 |
try { |
33 | 37 |
if( ! (value instanceof Byte) ) { |
34 | 38 |
if( value instanceof Number ) { |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java | ||
---|---|---|
29 | 29 |
public class CoerceToFloat implements Coercion { |
30 | 30 |
|
31 | 31 |
public Object coerce(Object value) throws CoercionException { |
32 |
if( value == null ) { |
|
33 |
return null; |
|
34 |
} |
|
32 | 35 |
try { |
33 | 36 |
if (!(value instanceof Float)) { |
34 | 37 |
if (value instanceof Number) { |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToString.java | ||
---|---|---|
29 | 29 |
public class CoerceToString implements Coercion { |
30 | 30 |
|
31 | 31 |
public Object coerce(Object value) throws CoercionException { |
32 |
if( value == null ) { |
|
33 |
return null; |
|
34 |
} |
|
32 | 35 |
try { |
33 | 36 |
if( !(value instanceof String )) { |
34 | 37 |
value = value.toString(); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java | ||
---|---|---|
29 | 29 |
public class CoerceToDouble implements Coercion { |
30 | 30 |
|
31 | 31 |
public Object coerce(Object value) throws CoercionException { |
32 |
if( value == null ) { |
|
33 |
return null; |
|
34 |
} |
|
32 | 35 |
try { |
33 | 36 |
if (!(value instanceof Double)) { |
34 | 37 |
if (value instanceof Number) { |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToBoolean.java | ||
---|---|---|
29 | 29 |
public class CoerceToBoolean implements Coercion { |
30 | 30 |
|
31 | 31 |
public Object coerce(Object value) throws CoercionException { |
32 |
if( value == null ) { |
|
33 |
return null; |
|
34 |
} |
|
35 |
|
|
32 | 36 |
try { |
33 | 37 |
if (!(value instanceof Boolean)) { |
34 | 38 |
if (value instanceof Number) { |
Also available in: Unified diff