Hi Tim,
I have a nice table in my training course showing the similarities
between the new feature model and a type system everyone is familiar
with ... Java; I will try and include JavaBeans as an example as well so
you get the idea of how a "popular" dynamic type system handles these
kinds of issues
-----------------guide to feature type
model-------------------------------------------
Java | JavaBean |
Feature Model
------------------|---------------------------------------------|------------------------
Class extends | BeanInfo |
SimpleFeatureType (extends ... AttributeType)
Object | Object (known as a "bean") |
SimpleFeature
Field | PropertyDescriptor |
AttributeDescriptor
Filed.getType() | PropertyDescriptor.getPropertyType(): Class |
AttributeDescriptor.getType(): AttributeType
SimpleFeature (used above) is limited to simple constructs like C structs.
DEFINITION
class Flag {
Point location;
String name;
int classification;
double height;
}
SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
b.setName( "Flag" );
b.setCRS( DefaultGeographicCRS.WSG84 );
b.add( "location", Point.class );
b.add( "name", String.class );
b.add( "classification", Integer.class );
b.add( "height", Double.class );
And finally to answer your questions:
- Why the separation between AttributeDescriptor and AttributeType? It is so we
can reuse our definition of the types; often you will have several fields of
the same kind just with different names.
- Why the separation between SimpleFeatureType and AttributeType? Same reason
we have primitive Classes in Java; some types have internal structure worth
thinking about and some do not..
We can go through the ComplexFeatureType example another day; once I know you
are happy with what is above?
jody
Tim Swanson wrote:
> Could someone give me a rundown of the distinctions between Types and
> Descriptors (e.g. AttributeType and AttributeDescriptor). I'm confused
> mainly because all of the *Type interfaces in the GeoTools legacy API
> are deprecated with pointers to their *Descriptor counterparts in the
> GeoAPI, yet the *Type classes exist there as well.
>
> Also, in these cases, some of the original methods on the legacy
> GeoTools Type interface indeed exist on the GeoAPI Descriptor interface,
> such as getMinOccurs(), but some exist on the GeoAPI Type interface,
> such as getBinding() (which is a rename of getType(), just to add to the
> confusion).
>
> So I've decided that rather than try to work backward from original
> intent to the current state (which has been my strategy so far), I would
> write here and ask, in the present design, what is the distinction
> between types and descriptors.
>
>
> Thanks,
>
>
>
> Tim Swanson
> Software Engineer
>
>
> Tyler Technologies, Inc.
> 14142 Denver West Parkway, Suite 155
> Lakewood, CO 80401
> Phone:
> Fax: 303-271-1930
> E-mail: [EMAIL PROTECTED]
> Web: www.tylertech.com
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users