Hi, I've implemented the Feature interface, and when I issue a WMS
GetMap, getAttributes(Obejct[]) is called on my Feature....however, I
am getting attribute type exceptions thrown higher up the stack.
Consider this short code snippet from getAttributes(Object[]) ->
note: attributes (below) is a HashMap where the key is the attribute
name and the value is an object drawn straight from the database
// this is what we expect
AttributeType schemaAttribute = featureType.getAttributeType(x);
String schemaName = schemaAttribute.getName();
Class schemaType = schemaAttribute.getType();
// this is what we got
Object o = this.attributes.get(schemaName);
String realType = o.toString();
logger.debug("schemaName: " + schemaName + "schemaType: " + schemaType
+ " realType: " + realType);
When I run this, I see (e.g.):
schemaName: maximumlengthallowed schemaType: class java.lang.Double
realType: class org.geotools.feature.type.NumericAttributeType
It so happens that this attribute value is null in the database so the
value of this attribute is also null. For those attribute values that
are non-null, I don't think an AttributeTypeException gets thrown.
Here are my questions:
1) I'm not sure where org.geotools.feature.type.NumericAttributeType
even comes from. The data structure for the feature's attributes is a
simple hash map of <name, object> -- How did it get cast to
NumericAttributeType?
2) I'm having difficulty figuring out how to properly cast an
attribute value dynamically if that is what I need to do. I can
figure out what the type should be from the FeatureType schema, but
I'm not sure how to cast this dynamically.
Am I doing this all wrong? If there is a better way, I'd love to hear about it.
Best regards,
Davis
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users