Here you can find the source of toOdaDataType(Class odiTypeClass)
Parameter | Description |
---|---|
odiTypeClass | a type class used by the Data Engine ODI component |
public static int toOdaDataType(Class odiTypeClass)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004, 2009 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://w ww. j av a 2 s . co m * Actuate Corporation - initial API and implementation *******************************************************************************/ import java.math.BigDecimal; import java.sql.Blob; import java.sql.Clob; import java.sql.Time; import java.sql.Timestamp; import java.sql.Types; public class Main { /** * Converts an ODI type class to its corresponding * ODA data type code. <br> * <b>ODI Type Class -> ODA Data Type</b><br> * <i>java.lang.Integer -> Integer<br> * java.lang.Double -> Double<br> * java.lang.String -> Character<br> * java.math.BigDecimal -> Decimal<br> * java.util.Date -> Timestamp<br> * java.sql.Date -> Date<br> * java.sql.Time -> Time<br> * java.sql.Timestamp -> Timestamp<br> * java.sql.Blob -> Blob<br> * java.sql.Clob -> Clob<br> * java.lang.Boolean -> Boolean<br> * java.lang.Object -> JavaObject<br> * </i><br> * All other type classes are mapped to the ODA String data type. * @param odiTypeClass a type class used by the Data Engine ODI component * @return the ODA data type that maps to the ODI type class. */ public static int toOdaDataType(Class odiTypeClass) { int odaType = Types.CHAR; // default if (odiTypeClass == null) odaType = Types.CHAR; else if (odiTypeClass == String.class) odaType = Types.CHAR; else if (odiTypeClass == Integer.class) odaType = Types.INTEGER; else if (odiTypeClass == Double.class) odaType = Types.DOUBLE; else if (odiTypeClass == BigDecimal.class) odaType = Types.DECIMAL; else if (odiTypeClass == Time.class) odaType = Types.TIME; else if (odiTypeClass == Timestamp.class) odaType = Types.TIMESTAMP; else if (odiTypeClass == java.sql.Date.class) odaType = Types.DATE; else if (odiTypeClass == java.util.Date.class) odaType = Types.TIMESTAMP; else if (odiTypeClass == Blob.class) odaType = Types.BLOB; else if (odiTypeClass == Clob.class) odaType = Types.CLOB; else if (odiTypeClass == Boolean.class) odaType = Types.BOOLEAN; else if (odiTypeClass == Object.class) odaType = Types.JAVA_OBJECT; return odaType; } }