]> git.mxchange.org Git - jcore.git/blobdiff - src/org/mxchange/jcore/BaseFrameworkSystem.java
Changed to SortedSet to keep ordering
[jcore.git] / src / org / mxchange / jcore / BaseFrameworkSystem.java
index 5443e55b0b89f12b411583644cdb504a89abfc1e..b48ad50e49d6a32faf7699efc7e860a0cfc2e47b 100644 (file)
@@ -41,7 +41,7 @@ import org.mxchange.jcore.client.Client;
 import org.mxchange.jcore.contact.Contact;
 import org.mxchange.jcore.database.backend.DatabaseBackend;
 import org.mxchange.jcore.database.frontend.DatabaseFrontend;
-import org.mxchange.jcore.database.storage.Storeable;
+import org.mxchange.jcore.database.storage.Storable;
 import org.mxchange.jcore.manager.Manageable;
 
 /**
@@ -447,11 +447,8 @@ public class BaseFrameworkSystem implements FrameworkInterface {
                // Trace message
                this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N
 
-               // First all lower case
-               String lower = columnName.toLowerCase();
-
-               // Then split on "_"
-               StringTokenizer tokenizer = new StringTokenizer(lower, "_"); //NOI18N
+               // Split on "_"
+               StringTokenizer tokenizer = new StringTokenizer(columnName, "_"); //NOI18N
 
                // Resulting string
                StringBuilder builder = new StringBuilder(tokenizer.countTokens());
@@ -586,19 +583,18 @@ public class BaseFrameworkSystem implements FrameworkInterface {
         *
         * @param str String to tokenize and get array from
         * @param delimiter Delimiter
-        * @param size Size of array
         * @return Array from tokenized string
-        * @todo Get rid of size parameter
+        * TODO Get rid of size parameter
         */
-       protected String[] getArrayFromString (final String str, final String delimiter, final int size) {
+       protected String[] getArrayFromString (final String str, final String delimiter) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("str={0},delimiter={1},size={2} - CALLED!", str, delimiter, size)); //NOI18N
+               this.getLogger().trace(MessageFormat.format("str={0},delimiter={1} - CALLED!", str, delimiter)); //NOI18N
 
                // Get tokenizer
                StringTokenizer tokenizer = new StringTokenizer(str, delimiter);
 
                // Init array and index
-               String[] tokens = new String[size];
+               String[] tokens = new String[tokenizer.countTokens()];
                int index = 0;
 
                // Run through all tokens
@@ -751,7 +747,7 @@ public class BaseFrameworkSystem implements FrameworkInterface {
                        object = null;
                } else {
                        // Hard-coded "cast" again ... :-(
-                       // @TODO Can't we get rid of this???
+                       // TODO Can't we get rid of this???
                        switch (type.getSimpleName()) {
                                case "Long": // Long object //NOI18N
                                        object = Long.parseLong((String) value);
@@ -841,7 +837,7 @@ public class BaseFrameworkSystem implements FrameworkInterface {
         * @throws java.lang.IllegalAccessException If the method cannot be accessed
         * @throws java.lang.reflect.InvocationTargetException Any other problems?
         */
-       protected Iterator<Map.Entry<Field, Object>> fieldIterator (final Storeable instance, final String className) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+       protected Iterator<Map.Entry<Field, Object>> fieldIterator (final Storable instance, final String className) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
                // Trace message
                this.getLogger().trace(MessageFormat.format("instance={0},className={1} - CALLED!", instance, className)); //NOI18N
 
@@ -1120,9 +1116,9 @@ public class BaseFrameworkSystem implements FrameworkInterface {
        }
 
        /**
-        * Some "setter" for a value in given Storeable instance and target class
+        * Some "setter" for a value in given Storable instance and target class
         * 
-        * @param instance An instance of a Storeable class
+        * @param instance An instance of a Storable class
         * @param targetClass The target class (where the field resides)
         * @param columnName Column name (= field name)
         * @param value Value to set
@@ -1130,7 +1126,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 Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+       protected void setValueInStorableFromColumn (final Storable instance, final String targetClass, final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
                this.getLogger().trace(MessageFormat.format("instance={0},targetClass={1},columnName={2},value={3} - CALLED!", instance, targetClass, columnName, value)); //NOI18N
 
@@ -1163,9 +1159,9 @@ public class BaseFrameworkSystem implements FrameworkInterface {
        }
 
        /**
-        * Some "getter" for a value from given Storeable instance and target class
+        * Some "getter" for a value from given Storable instance and target class
         *
-        * @param instance An instance of a Storeable class
+        * @param instance An instance of a Storable class
         * @param targetClass The target class (where the field resides)
         * @param columnName Column name (= field name)
         * @return  value Value to get
@@ -1173,7 +1169,7 @@ public class BaseFrameworkSystem implements FrameworkInterface {
         * @throws java.lang.IllegalAccessException If the getter cannot be accessed
         * @throws java.lang.reflect.InvocationTargetException Some other problems?
         */
-       protected Object getValueInStoreableFromColumn (final Storeable instance, final String targetClass, final String columnName) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+       protected Object getValueInStorableFromColumn (final Storable instance, final String targetClass, final String columnName) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace message
                this.getLogger().trace(MessageFormat.format("instance={0},targetClass={1},columnName={2} - CALLED!", instance, targetClass, columnName)); //NOI18N
 
@@ -1240,6 +1236,14 @@ public class BaseFrameworkSystem implements FrameworkInterface {
 
                // Search for proper field instance
                for (final Field field : fields) {
+                       // Is a dollar character there?
+                       if (field.getName().startsWith("$")) { //NOI18N
+                               // Debug message
+                               this.getLogger().debug(MessageFormat.format("Field name {0} starts with a dollar, skipped.", field.getName())); //NOI18N
+                               // Skip this
+                               continue;
+                       }
+
                        // Debug message
                        this.getLogger().debug(MessageFormat.format("field.getName()={0},fieldName={1}", field.getName(), fieldName)); //NOI18N