GeoTools : CreateAFeatureType

Defining a feature type is like defining a java class... We need then to instantiate it.
The code below shows how simple it is to create a feature type.

// we create an attribute - like an instance variable in a java class
// this attribute is a geometric data (point, polygon, and so on...)
AttributeType geom = AttributeTypeFactory.newAttributeType("the_geom", LineString.class);

//another one simpler
AttributeType roadWidth = AttributeTypeFactory.newAttributeType("width", Float.class);

// we create the feature type itself
FeatureType ftRoad = FeatureTypeFactory.newFeatureType(new AttributeType[] {geom, roadWidth}, "road");