Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright 2021 Fred Feng ([email protected])
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.paganini2008.devtools.db4j;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.github.paganini2008.devtools.jdbc.PreparedStatementCallback;
/**
*
* Db4jUtils
*
* @author Fred Feng
* @version 1.0
*/
public abstract class Db4jUtils {
private static final Map classNamesAndJavaTypes = new HashMap();
static {
classNamesAndJavaTypes.put(Byte.class.getName(), Byte.class);
classNamesAndJavaTypes.put(Short.class.getName(), Short.class);
classNamesAndJavaTypes.put(Integer.class.getName(), Integer.class);
classNamesAndJavaTypes.put(Long.class.getName(), Long.class);
classNamesAndJavaTypes.put(Float.class.getName(), Float.class);
classNamesAndJavaTypes.put(Double.class.getName(), Double.class);
classNamesAndJavaTypes.put(Character.class.getName(), Character.class);
classNamesAndJavaTypes.put(Boolean.class.getName(), Boolean.class);
classNamesAndJavaTypes.put(Byte.TYPE.getName(), Byte.TYPE);
classNamesAndJavaTypes.put(Short.TYPE.getName(), Short.TYPE);
classNamesAndJavaTypes.put(Integer.TYPE.getName(), Integer.TYPE);
classNamesAndJavaTypes.put(Long.TYPE.getName(), Long.TYPE);
classNamesAndJavaTypes.put(Float.TYPE.getName(), Float.TYPE);
classNamesAndJavaTypes.put(Double.TYPE.getName(), Double.TYPE);
classNamesAndJavaTypes.put(Character.TYPE.getName(), Character.TYPE);
classNamesAndJavaTypes.put(Boolean.TYPE.getName(), Boolean.TYPE);
classNamesAndJavaTypes.put(BigDecimal.class.getName(), BigDecimal.class);
classNamesAndJavaTypes.put(BigInteger.class.getName(), BigInteger.class);
classNamesAndJavaTypes.put(String.class.getName(), String.class);
classNamesAndJavaTypes.put(Date.class.getName(), Date.class);
classNamesAndJavaTypes.put(Time.class.getName(), Time.class);
classNamesAndJavaTypes.put(Timestamp.class.getName(), Timestamp.class);
classNamesAndJavaTypes.put(byte[].class.getName(), byte[].class);
}
public static void mappingClassNameAndJavaType(String className, Type javaType) {
classNamesAndJavaTypes.put(className, javaType);
}
public static Map getClassNamesAndJavaTypes() {
return classNamesAndJavaTypes;
}
public static PreparedStatementCallback batchPrepare(List