org.geotools.feature
Class FeatureFactoryImpl

java.lang.Object
  extended byorg.geotools.feature.FeatureFactoryImpl
All Implemented Interfaces:
FeatureFactory2

public class FeatureFactoryImpl
extends java.lang.Object
implements FeatureFactory2

Implementaton of *just* FeatureFactory for use by a FeatureType instance.

The only thing this class does is create features according to the provided schema. Schemas can not change after being edited, so the fact that the feature has a reference to its schema is not a problem.

Notes on the use of Index with respect to type inheritence:
Given the above actual decision we can provide a consistence "index" for each attribute type in a single in heiritence feature type heirarchy. An index associated with a parent will indicate the location in the create value list for information for itself and all child types.

Multiple inheiritence is not considered by this FeatureFactoryImpl, to do multiple inheritence cannot be consistently defined using our existing API. However some things are clear for next time when we actualy do set up multiple inheritence. AttributeType overrides restrictions are still combined with AND, conflicts between attributes from different parents are where the trouble is at. The only answer is to kill the index idea, and force everyone to use real AttributeTypes to look up their information (aka strongly typed index).

Recomendations:
I recommend that we provide the AttributeType based lookup, and deprecate the index methods for the Geotools 2.1 timeframe. This would allow us to provide type safty now, and allow us to to multiple inheirtience in the Geotools 2.2 timeframe when the index methods are used. (This recomendation is based on a lost attempt at multiple inheirtence, one really cannot produce a consistent implementation based on index).

Since:
0.6.0
Author:
Jody Garnett

Constructor Summary
FeatureFactoryImpl()
           
 
Method Summary
 Feature create(FeatureType schema, AttributeType[] type, java.lang.Object[] value)
          AttributeType typesafe Feature creations.
 Feature create(FeatureType flatSchema, java.lang.Object[] values)
          Convience method for FlatFeatureType for feature creation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureFactoryImpl

public FeatureFactoryImpl()
Method Detail

create

public Feature create(FeatureType schema,
                      AttributeType[] type,
                      java.lang.Object[] value)
Description copied from interface: FeatureFactory2
AttributeType typesafe Feature creations.

This is option one, it works for both FeatureType and FlatFeatureType. Duplicate AttributeType are of course allowed (as long as the provided FeatureType supports this).

Specified by:
create in interface FeatureFactory2
Parameters:
type - List of AttributeType in creation order
value - List of attribute value in creation order
Returns:
Feature create according to the provided schema.

create

public Feature create(FeatureType flatSchema,
                      java.lang.Object[] values)
Description copied from interface: FeatureFactory2
Convience method for FlatFeatureType for feature creation.

This is a convience method to ease the transition phase for developers making use of a FlatFeatureType.

The use of this method should be considered to be *exactly* the same as:


 factory.create( flatSchema, flatSchema.getAttributeTypes(), values ); 
 
A you can see this is only valid for FlatFeature schema in which the results of getAttributeTypes() describes all the parameters required for creation. For most shape and database base content this is a valid assumption.

Specified by:
create in interface FeatureFactory2
Returns:
Feature create according to the provided schema.


Copyright © GeoTools. All Rights Reserved.