From 6ad4f22216705fa8a91ad3389ede7e0ce074fad4 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 14 Aug 2015 21:48:53 +0200 Subject: [PATCH] =?utf8?q?Changed=20parameter=20type=20from=20String=20to?= =?utf8?q?=20Object=20+=20implemented=20one=20setter=20Signed-off-by:Rolan?= =?utf8?q?d=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/org/mxchange/jcore/BaseFrameworkSystem.java | 6 +++--- src/org/mxchange/jcore/contact/BaseContact.java | 11 +++++++++-- .../mxchange/jcore/database/storage/Storeable.java | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/org/mxchange/jcore/BaseFrameworkSystem.java b/src/org/mxchange/jcore/BaseFrameworkSystem.java index f6a1cb5..2dd9dd2 100644 --- a/src/org/mxchange/jcore/BaseFrameworkSystem.java +++ b/src/org/mxchange/jcore/BaseFrameworkSystem.java @@ -680,7 +680,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { * @throws java.lang.IllegalAccessException If the method cannot be accessed * @throws java.lang.reflect.InvocationTargetException Some other problems? */ - protected void setField (final FrameworkInterface instance, final String targetClass, final String methodName, final String value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + protected void setField (final FrameworkInterface instance, final String targetClass, final String methodName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { // Trace messahe this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1},value={2}", targetClass, methodName, value)); //NOI18N @@ -1005,7 +1005,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { * @throws java.lang.IllegalAccessException If the setter cannot be accessed * @throws java.lang.reflect.InvocationTargetException Any other problem? */ - protected void setValueInStoreableFromColumn (final Storeable instance, final String targetClass, final String columnName, final String value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + protected void setValueInStoreableFromColumn (final Storeable instance, final String targetClass, final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { // Trace message this.getLogger().trace("instance=" + instance + ",targetClass=" + targetClass + ",columnName=" + columnName + ",value=" + value + " - CALLED!"); @@ -1021,7 +1021,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { this.getLogger().debug("Column " + columnName + " represents a boolean field."); // Yes, then call other method - this.setBooleanField(instance, targetClass, this.convertColumnNameToSetterMethod(columnName), Boolean.parseBoolean(value)); + this.setBooleanField(instance, targetClass, this.convertColumnNameToSetterMethod(columnName), (Boolean) value); } // Convert column name to field name diff --git a/src/org/mxchange/jcore/contact/BaseContact.java b/src/org/mxchange/jcore/contact/BaseContact.java index cb9232d..71a7d30 100644 --- a/src/org/mxchange/jcore/contact/BaseContact.java +++ b/src/org/mxchange/jcore/contact/BaseContact.java @@ -606,7 +606,14 @@ public class BaseContact extends BaseFrameworkSystem implements Contact { } @Override - public void setValueFromColumn (final String columnName, String value) { - throw new UnsupportedOperationException("Not supported yet: columnName=" + columnName + ",value=" + value); + public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + // Trace message + this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value)); + + // Call super method + this.setValueInStoreableFromColumn(this, "BaseContact", columnName, value); + + // Trace message + this.getLogger().trace("EXIT!"); } } diff --git a/src/org/mxchange/jcore/database/storage/Storeable.java b/src/org/mxchange/jcore/database/storage/Storeable.java index 42d7b43..f412bcc 100644 --- a/src/org/mxchange/jcore/database/storage/Storeable.java +++ b/src/org/mxchange/jcore/database/storage/Storeable.java @@ -49,5 +49,5 @@ public interface Storeable extends FrameworkInterface { * @throws java.lang.IllegalAccessException If the method cannot be accessed * @throws java.lang.reflect.InvocationTargetException Any other problems? */ - public void setValueFromColumn (final String columnName, final String value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException; + public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException; } -- 2.39.5