Revision 44644 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractFunction.java

View differences:

AbstractFunction.java
23 23
import org.gvsig.expressionevaluator.Function;
24 24
import org.gvsig.expressionevaluator.I18N;
25 25
import org.gvsig.expressionevaluator.Interpreter;
26
import org.gvsig.fmap.geom.Geometry;
27
import org.gvsig.fmap.geom.primitive.Point;
26
//import org.gvsig.fmap.geom.Geometry;
27
//import org.gvsig.fmap.geom.primitive.Point;
28 28
import org.json.JSONArray;
29 29
import org.json.JSONObject;
30 30

  
......
90 90

  
91 91
    @Override
92 92
    public String description() {
93
        if( StringUtils.equalsIgnoreCase(System.getProperty("ExpressionEvaluatorReloadFunctionResources"), "true")) {
94
            load_from_resource();
95
        }
93 96
        return description;
94 97
    }
95 98

  
......
256 259
        return value;
257 260
    }
258 261
    
259
    protected Geometry getGeom(Object[] args, int n) {
260
        return this.getGeom(args, n, false);
261
    }
262
    
263
    protected Geometry getGeom(Object[] args, int n, boolean allowNull) {
264
        if( args.length < n  ) {
265
            throw new IllegalArgumentException(I18N.Required_argument_XargnX_and_only_found_XargcX_in_call_to_XIdentifierX(name(), args.length, n));
266
        }
267
        Object value = args[n];
268
        if( value == null ) {
269
            if( allowNull ) {
270
                return null;
271
            }
272
            throw new IllegalArgumentException(I18N.Illegal_null_value_for_argument_XargnX_of_XIdentifierX_function(name(), n));
273
        }
274
        if( !(value instanceof Geometry) ) {
275
            String type = value.getClass().getCanonicalName();
276
            throw new IllegalArgumentException(
277
                    I18N.The_type_of_the_argument_XargnX_for_the_XIdentifierX_function_is_incorrect(name(), n) + " " +
278
                    I18N.Expected_XexpectedX_and_found_XfoundX("Geometry",type)
279
            );
280
        }
281
        return (Geometry)value;
282
    }
283

  
284
    protected Point getPoint(Object[] args, int n) {
285
        if( args.length < n  ) {
286
            throw new IllegalArgumentException(I18N.Required_argument_XargnX_and_only_found_XargcX_in_call_to_XIdentifierX(name(), args.length, n));
287
        }
288
        Object value = args[n];
289
        if( value == null ) {
290
            return null;
291
        }
292
        if( !(value instanceof Point) ) {
293
            String type = value.getClass().getCanonicalName();
294
            throw new IllegalArgumentException(
295
                    I18N.The_type_of_the_argument_XargnX_for_the_XIdentifierX_function_is_incorrect(name(), n) + " " +
296
                    I18N.Expected_XexpectedX_and_found_XfoundX("Point",type)
297
            );
298
        }
299
        return (Point)value;
300
    }
301
    
302 262
    protected Date getDate(Object[] args, int n) {
303 263
        if( args.length < n  ) {
304 264
            throw new IllegalArgumentException(I18N.Required_argument_XargnX_and_only_found_XargcX_in_call_to_XIdentifierX(name(), args.length, n));

Also available in: Unified diff