[Schmitzm-commits] r1916 - trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 28 12:15:09 CEST 2012
Author: alfonx
Date: 2012-03-28 12:15:08 +0200 (Wed, 28 Mar 2012)
New Revision: 1916
Modified:
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java
Log:
http://stackoverflow.com/questions/7689386/why-doesnt-autoboxing-overrule-varargs-when-using-method-overloading-in-java-7
probleme mit createFeature
gel?\195?\182st indem alle drei alten mehtiode auf deprecated gesetzt wurden, und EINE neue methode mit allen parametern erstellt. die nutzer der funktion sollen nur die eine neue methode verwenden und NULL ?\195?\188bergeben wenn die paramter nicht definiert werden.
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java 2012-03-27 14:22:28 UTC (rev 1915)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java 2012-03-28 10:15:08 UTC (rev 1916)
@@ -2050,14 +2050,23 @@
* @param schema
* schema for the feature
* @param forceNewBuilder
- * forces the creation of a new {@link SimpleFeatureBuilder}
+ * forces the creation of a new {@link SimpleFeatureBuilder}. If
+ * <code>null</code> <code>false</code> is used.
* @param fID
- * feature id for the new feature
+ * feature id for the new feature. If <code>null</code> a random
+ * ID will be generated
* @param attrValues
* values of the attributes
*/
- public static SimpleFeature createFeature(SimpleFeatureType schema,
- boolean forceNewBuilder, String fID, Object... attrValues) {
+ public static SimpleFeature createFeatureInstance(SimpleFeatureType schema,
+ Boolean forceNewBuilder, String fID, Object... attrValues) {
+
+ if (fID == null)
+ fID = "FID_" + new Random().nextInt();
+
+ if (forceNewBuilder == null)
+ forceNewBuilder = false;
+
SimpleFeatureBuilder builder = getFeatureBuilderFromCache(schema,
forceNewBuilder);
return builder.buildFeature(fID, attrValues);
@@ -2072,8 +2081,29 @@
* feature id for the new feature
* @param attrValues
* values of the attributes
+ * @deprecated use
+ * {@link #createFeatureInstance(SimpleFeatureType, Boolean, String, Object...)}
+ * to avoid ambiguous method calls. http://stackoverflow.com/questions/7689386/why-doesnt-autoboxing-overrule-varargs-when-using-method-overloading-in-java-7
*/
public static SimpleFeature createFeature(SimpleFeatureType schema,
+ Boolean forceNewBuilder, String fID, Object... attrValues) {
+ return createFeatureInstance(schema, forceNewBuilder, fID, attrValues);
+ }
+
+ /**
+ * Creates a new feature for a given schema.
+ *
+ * @param schema
+ * schema for the feature
+ * @param fID
+ * feature id for the new feature
+ * @param attrValues
+ * values of the attributes
+ * @deprecated use
+ * {@link #createFeatureInstance(SimpleFeatureType, Boolean, String, Object...)}
+ * to avoid ambiguous method calls. http://stackoverflow.com/questions/7689386/why-doesnt-autoboxing-overrule-varargs-when-using-method-overloading-in-java-7
+ */
+ public static SimpleFeature createFeature(SimpleFeatureType schema,
String fID, Object... attrValues) {
return createFeature(schema, false, fID, attrValues);
}
@@ -2085,6 +2115,9 @@
* schema for the feature
* @param attrValues
* values of the attributes
+ * @deprecated use
+ * {@link #createFeatureInstance(SimpleFeatureType, Boolean, String, Object...)}
+ * to avoid ambiguous method calls. http://stackoverflow.com/questions/7689386/why-doesnt-autoboxing-overrule-varargs-when-using-method-overloading-in-java-7
*/
public static SimpleFeature createFeature(SimpleFeatureType schema,
Object... attrValues) {
More information about the Schmitzm-commits
mailing list