Hi Jody, it's totally fine that id is required for Feature, that is not what I'm talking about.
I mean createAttribute (that leads to new AttributeImpl()), createGeometryAttribute (leading to new GeometryAttributeImpl()), and createComplexAttribute (for new ComplexAttributeImpl() in turn). createFeature does new FeatureImpl() and createSimpleFeature new SimpleFeatureImpl, both correctly requiring id not being null. But for the other three id should not be enforced. Cheers, Gabriel On Fri, Jul 15, 2011 at 11:27 PM, Jody Garnett <[email protected]> wrote: > Since we were working from GML (in which features can be referenced by id) > we actually do require an ID (ie FeatureID) be provided. > So the javadocs for ID may be wrong; remember we grab the idea of ID from a > base class; and it is only mandatory of the AttributeType says it is > required. And for features that is always true.... > Please not there is some hacking around the use of FeatureID; in order to > facilitate the idea of an ID that can be set "after" creation. Look in the > TransactionStateDiff code; there are some magic user data properties you can > set to get the ID supplied. > -- > Jody Garnett > > On Saturday, 16 July 2011 at 4:00 AM, Gabriel Roldan wrote: > > Hi all, > > WRT http://jira.codehaus.org/browse/GEOT-3726, I think I know the > motivation not to do > > new AttributeImpl(value,descriptor, id == null? null : ff.gmlObjectId(id)); > > instead of new AttributeImpl(value,descriptor, ff.gmlObjectId(id)); > as it's now, and it might be that we wanted factories to be logic-less? > Yet breaking the interface contract is not good. > > If no objections I'll commit the above fix to build a no-id attribute > if null has been passed as the id argument. > But what should be done in the longer term, if enforcing logic-less > factories is so vital, is to extend the FeatureFactory interface with > overloaded versions of the create***Attribute methods, like in: > > Attribute createAttribute(Object value, AttributeDescriptor descriptor); > Attribute createAttribute(Object value, AttributeDescriptor > descriptor, String id); > > So that the former builds a null id attribute, and the later one with > id, and the client code is in charge of respecting the contract as it > should be? > > Opinions? > > Cheers, > > Gabriel > > 2011/7/15 Gabriel Roldán (JIRA) <[email protected]>: > > AbstractFeatureFactoryImpl forces attribute id not to be null (and fails > otherwise) even though the interface contract states id can be null > -------------------------------------------------------------------------------------------------------------------------------------------- > > Key: GEOT-3726 > URL: https://jira.codehaus.org/browse/GEOT-3726 > Project: GeoTools > Issue Type: Bug > Reporter: Gabriel Roldán > Assignee: Gabriel Roldán > > > The contract for FeatureFactory.createAttribute, createGeometryAttribute, > and createComplexAttribute says the id argument can be null, yet > AbstractFeatureFactoryImpl produces a NPE if given a null id as argument as > it calls FilterFactory.gmlObjectId(id) without checking. > > Surprisingly there seems to be not a single call to any of these methods in > the code base. > > -- > This message is automatically generated by JIRA. > For more information on JIRA, see: http://www.atlassian.com/software/jira > > > > ------------------------------------------------------------------------------ > AppSumo Presents a FREE Video for the SourceForge Community by Eric > Ries, the creator of the Lean Startup Methodology on "Lean Startup > Secrets Revealed." This video shows you how to validate your ideas, > optimize your ideas and identify your business strategy. > http://p.sf.net/sfu/appsumosfdev2dev > _______________________________________________ > Geotools-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-devel > > > > -- > Gabriel Roldan > OpenGeo - http://opengeo.org > Expert service straight from the developers. > > ------------------------------------------------------------------------------ > AppSumo Presents a FREE Video for the SourceForge Community by Eric > Ries, the creator of the Lean Startup Methodology on "Lean Startup > Secrets Revealed." This video shows you how to validate your ideas, > optimize your ideas and identify your business strategy. > http://p.sf.net/sfu/appsumosfdev2dev > _______________________________________________ > Geotools-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-devel > > -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
