Revision 44331 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java
DefaultFeature.java | ||
---|---|---|
278 | 278 |
return this.reference; |
279 | 279 |
} |
280 | 280 |
|
281 |
@Override |
|
282 |
public Object getOrDefault(String name, Object defaultValue) { |
|
283 |
int index = this.data.getType().getIndex(name); |
|
284 |
if( index < 0 ) { |
|
285 |
return defaultValue; |
|
286 |
} |
|
287 |
return this.get(index); |
|
288 |
} |
|
289 |
|
|
290 |
@Override |
|
291 |
public String getStringOrDefault(String name, String defaultValue) { |
|
292 |
int index = this.data.getType().getIndex(name); |
|
293 |
if( index < 0 ) { |
|
294 |
return defaultValue; |
|
295 |
} |
|
296 |
try { |
|
297 |
return (String) this.get(index); |
|
298 |
} catch(Throwable th) { |
|
299 |
return defaultValue; |
|
300 |
} |
|
301 |
} |
|
302 |
|
|
303 |
@Override |
|
304 |
public int getIntOrDefault(String name, int defaultValue) { |
|
305 |
int index = this.data.getType().getIndex(name); |
|
306 |
if( index < 0 ) { |
|
307 |
return defaultValue; |
|
308 |
} |
|
309 |
try { |
|
310 |
return (int) this.get(index); |
|
311 |
} catch(Throwable th) { |
|
312 |
return defaultValue; |
|
313 |
} |
|
314 |
} |
|
315 |
|
|
316 |
@Override |
|
317 |
public long getLongOrDefault(String name, long defaultValue) { |
|
318 |
int index = this.data.getType().getIndex(name); |
|
319 |
if( index < 0 ) { |
|
320 |
return defaultValue; |
|
321 |
} |
|
322 |
try { |
|
323 |
return (long) this.get(index); |
|
324 |
} catch(Throwable th) { |
|
325 |
return defaultValue; |
|
326 |
} |
|
327 |
} |
|
328 |
|
|
329 |
@Override |
|
330 |
public float getFloatOrDefault(String name, float defaultValue) { |
|
331 |
int index = this.data.getType().getIndex(name); |
|
332 |
if( index < 0 ) { |
|
333 |
return defaultValue; |
|
334 |
} |
|
335 |
try { |
|
336 |
return (float) this.get(index); |
|
337 |
} catch(Throwable th) { |
|
338 |
return defaultValue; |
|
339 |
} |
|
340 |
} |
|
341 |
|
|
342 |
@Override |
|
343 |
public double getDoubleOrDefault(String name, double defaultValue) { |
|
344 |
int index = this.data.getType().getIndex(name); |
|
345 |
if( index < 0 ) { |
|
346 |
return defaultValue; |
|
347 |
} |
|
348 |
try { |
|
349 |
return (double) this.get(index); |
|
350 |
} catch(Throwable th) { |
|
351 |
return defaultValue; |
|
352 |
} |
|
353 |
} |
|
354 |
|
|
355 |
@Override |
|
356 |
public Date getDateOrDefault(String name, Date defaultValue) { |
|
357 |
int index = this.data.getType().getIndex(name); |
|
358 |
if( index < 0 ) { |
|
359 |
return defaultValue; |
|
360 |
} |
|
361 |
try { |
|
362 |
return (Date) this.get(index); |
|
363 |
} catch(Throwable th) { |
|
364 |
return defaultValue; |
|
365 |
} |
|
366 |
} |
|
367 |
|
|
368 |
@Override |
|
369 |
public Object getOrDefault(int index, Object defaultValue) { |
|
370 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
371 |
return defaultValue; |
|
372 |
} |
|
373 |
try { |
|
374 |
return this.get(index); |
|
375 |
} catch(Throwable th) { |
|
376 |
return defaultValue; |
|
377 |
} |
|
378 |
} |
|
379 |
|
|
380 |
@Override |
|
381 |
public String getStringOrDefault(int index, String defaultValue) { |
|
382 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
383 |
return defaultValue; |
|
384 |
} |
|
385 |
try { |
|
386 |
return (String) this.get(index); |
|
387 |
} catch(Throwable th) { |
|
388 |
return defaultValue; |
|
389 |
} |
|
390 |
} |
|
391 |
|
|
392 |
@Override |
|
393 |
public int getIntOrDefault(int index, int defaultValue) { |
|
394 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
395 |
return defaultValue; |
|
396 |
} |
|
397 |
try { |
|
398 |
return (int) this.get(index); |
|
399 |
} catch(Throwable th) { |
|
400 |
return defaultValue; |
|
401 |
} |
|
402 |
} |
|
403 |
|
|
404 |
@Override |
|
405 |
public long getLongOrDefault(int index, long defaultValue) { |
|
406 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
407 |
return defaultValue; |
|
408 |
} |
|
409 |
try { |
|
410 |
return (long) this.get(index); |
|
411 |
} catch(Throwable th) { |
|
412 |
return defaultValue; |
|
413 |
} |
|
414 |
} |
|
415 |
|
|
416 |
@Override |
|
417 |
public float getFloatOrDefault(int index, float defaultValue) { |
|
418 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
419 |
return defaultValue; |
|
420 |
} |
|
421 |
try { |
|
422 |
return (float) this.get(index); |
|
423 |
} catch(Throwable th) { |
|
424 |
return defaultValue; |
|
425 |
} |
|
426 |
} |
|
427 |
|
|
428 |
@Override |
|
429 |
public double getDoubleOrDefault(int index, double defaultValue) { |
|
430 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
431 |
return defaultValue; |
|
432 |
} |
|
433 |
try { |
|
434 |
return (double) this.get(index); |
|
435 |
} catch(Throwable th) { |
|
436 |
return defaultValue; |
|
437 |
} |
|
438 |
} |
|
439 |
|
|
440 |
@Override |
|
441 |
public Date getDateOrDefault(int index, Date defaultValue) { |
|
442 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
443 |
return defaultValue; |
|
444 |
} |
|
445 |
try { |
|
446 |
return (Date) this.get(index); |
|
447 |
} catch(Throwable th) { |
|
448 |
return defaultValue; |
|
449 |
} |
|
450 |
} |
|
451 |
|
|
281 | 452 |
class UnableToGetReferenceException extends BaseRuntimeException { |
282 | 453 |
|
283 | 454 |
/** |
Also available in: Unified diff