|
From: Andrew H. <ahu...@cc...> - 2014-04-29 16:01:39
|
Hi all,
I noticed that in SimpleFeatureImpl the setAttribute() methods attempt
to convert an Object into the correct type based on the
AttributeDescriptor but the setAttributes() method takes an entire list
of values and does NOT do conversion. The ResultSetFeature
implementation does not attempt to convert types when setting but does
convert types when in the next() method.
Example from SimpleFeatureImpl:
public void setAttribute(int index, Object value) throws
IndexOutOfBoundsException {
// first do conversion
Object converted = Converters.convert(value,
getFeatureType().getDescriptor(index).getType().getBinding());
...
}
Question: If I am making my own simple feature implementation, is it
expected that I do type conversion in the setAttribute method? Is there
any history behind why there are two pathways (one which converts and
one that doesn't)? It seems that if the user wanted that they could use
the validating option (though its nice to do a conversion for them).
Though I'd like to not do conversions, I wanted to check to see if there
was that expectation or convention.
Thanks,
Andrew Hulbert
|