Add method to set a field by its index.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 12 Jan 2011 09:32:00 +0000 (10:32 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 12 Jan 2011 09:32:00 +0000 (10:32 +0100)
src/main/java/net/pterodactylus/sone/data/Profile.java

index 64aeae4..0c86732 100644 (file)
@@ -318,6 +318,19 @@ public class Profile implements Fingerprintable {
        /**
         * Sets the value of the field with the given name.
         *
+        * @param fieldIndex
+        *            The index of the field
+        * @param value
+        *            The value of the field
+        */
+       public void setField(int fieldIndex, String value) {
+               Validation.begin().isGreaterOrEqual("Field Index", fieldIndex, 0).isLess("Field Index", fieldIndex, fields.size()).check();
+               setField(fields.get(fieldIndex), value);
+       }
+
+       /**
+        * Sets the value of the field with the given name.
+        *
         * @param field
         *            The name of the field
         * @param value