FeatureDataUtils { public static SimpleFeatureType decodeType( final String nameSpace, final String typeName, final String typeDescriptor, final String axis) throws SchemaException { SimpleFeatureType featureType = (nameSpace != null) && (nameSpace.length() > 0) ? DataUtilities.createType(nameSpace, typeName, typeDescriptor) : DataUtilities.createType(typeName, typeDescriptor); final String lCaseAxis = axis.toLowerCase(Locale.ENGLISH); final CoordinateReferenceSystem crs = featureType.getCoordinateReferenceSystem(); final String typeAxis = getAxis(crs); if ((crs != null) && crs.getIdentifiers().toString().contains("EPSG:4326") && !lCaseAxis.equalsIgnoreCase(typeAxis)) { final SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); try { featureType = SimpleFeatureTypeBuilder.retype( featureType, CRS.decode("EPSG:4326", lCaseAxis.equals("east"))); } catch (final FactoryException e) { throw new SchemaException("Cannot decode EPSG:4326", e); } } return featureType; }  static String getAxis(final CoordinateReferenceSystem crs); static SimpleFeatureType decodeType(
      final String nameSpace,
      final String typeName,
      final String typeDescriptor,
      final String axis); static SimpleFeature buildFeature(
      final SimpleFeatureType featureType,
      final Pair<String, Object>[] entries); static SimpleFeatureType getFeatureType(
      final DataStorePluginOptions dataStore,
      String typeName); static FeatureDataAdapter cloneFeatureDataAdapter(
      final DataStorePluginOptions storeOptions,
      final String originalTypeName,
      final String newTypeName); static String getGeomField(final DataStorePluginOptions dataStore, final String typeName); static String getTimeField(final DataStorePluginOptions dataStore, final String typeName); static int getFeatureAdapterCount(final DataStorePluginOptions dataStore); static List<String> getFeatureTypeNames(final DataStorePluginOptions dataStore);  }
@Test public void testWithSRID() throws SchemaException { final SimpleFeatureType type = FeatureDataUtils.decodeType( "http: "type1", "geometry:Geometry:srid=4326,pop:java.lang.Long,when:Date,whennot:Date,pid:String", "east"); assertEquals("type1", type.getName().getLocalPart()); }
@Test public void testWithoutSRID() throws SchemaException { final SimpleFeatureType type = FeatureDataUtils.decodeType( "http: "type1", "geometry:Geometry,pop:java.lang.Long,when:Date,whennot:Date,pid:String", StringUtils.stringFromBinary(new byte[0])); assertEquals("type1", type.getName().getLocalPart()); }