OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 182 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 182 Rev 185
Line 1103... Line 1103...
1103
    }
1103
    }
1104
 
1104
 
1105
    // TODO support java.time.LocalDateTime in Java 8
1105
    // TODO support java.time.LocalDateTime in Java 8
1106
    public static <T, U> U convert(final Class<T> source, final Object value, final Class<U> dest) {
1106
    public static <T, U> U convert(final Class<T> source, final Object value, final Class<U> dest) {
1107
        final ValueConvertor<T, U> conv = ValueConvertorFactory.find(source, dest);
1107
        final ValueConvertor<T, U> conv = ValueConvertorFactory.find(source, dest);
1108
        if (conv == null)
1108
        if (conv == null) {
-
 
1109
            // FIXME erreur dans passer une commande depuis le calcul des besoin, code à retirer
-
 
1110
            if (SQLRowAccessor.class.isAssignableFrom(source) && Integer.class.isAssignableFrom(dest)) {
-
 
1111
                System.err.println("Conversion d'une row en integer " + ((SQLRowAccessor) source.cast(value)).toString());
-
 
1112
                Thread.dumpStack();
-
 
1113
                return dest.cast(((SQLRowAccessor) source.cast(value)).getID());
-
 
1114
            } else {
1109
            throw new IllegalArgumentException("No convertor to " + dest + " from " + source);
1115
                throw new IllegalArgumentException("No convertor to " + dest + " from " + source);
-
 
1116
            }
-
 
1117
 
-
 
1118
        }
1110
        return conv.convert(source.cast(value));
1119
        return conv.convert(source.cast(value));
1111
    }
1120
    }
1112
 
1121
 
1113
    private void _put(String fieldName, Object value, final boolean checkName, final ValueOperation checkValue) {
1122
    private void _put(String fieldName, Object value, final boolean checkName, final ValueOperation checkValue) {
1114
        // table.contains() can take up to 35% of this method
1123
        // table.contains() can take up to 35% of this method