]> git.mxchange.org Git - jcore.git/blobdiff - src/org/mxchange/jcore/contact/BaseContact.java
Better return an iterator of Map.Entry<Field, Object>. This is really generic, it...
[jcore.git] / src / org / mxchange / jcore / contact / BaseContact.java
index 9085faa92c51f39ed415da4788e99fd7669ea024..b817a594721c68e4a062796b1b5a2edf63e13fa4 100644 (file)
  */
 package org.mxchange.jcore.contact;
 
+import java.lang.reflect.Field;
 import java.text.MessageFormat;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Objects;
 import org.mxchange.jcore.BaseFrameworkSystem;
 import org.mxchange.jcore.client.Client;
@@ -480,14 +482,23 @@ public class BaseContact extends BaseFrameworkSystem implements Contact {
         * @return Value from field
         */
        @Override
-       public Object getValueFromColumn (final String columnName) {
+       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException {
                // Trace message
                this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName));
 
+               // A '$' means not our field
+               if (columnName.startsWith("$")) {
+                       // Don't handle these
+                       throw new IllegalArgumentException("columnsName contains $");
+               }
+
                // Determine if the given column is boolean
                if (this.isBooleanField(this, "BaseContact", columnName)) {
+                       // Debug message
+                       this.getLogger().debug("Column " + columnName + " represents a boolean field.");
+
                        // Yes, then call other method
-                       return this.getBooleanField(this, "BaseContact", columnName);
+                       return this.getBooleanField(this, "BaseContact", this.convertColumnNameToGetterMethod(columnName, true));
                }
 
                // Convert column name to field name
@@ -587,7 +598,7 @@ public class BaseContact extends BaseFrameworkSystem implements Contact {
         * @return An iterator
         */
        @Override
-       public Iterator<Object> iterator () {
+       public Iterator<Map.Entry<Field, Object>> iterator () {
                return this.fieldIterator(this, "BaseContact");
        }