package view;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import oracle.jbo.domain.Date;
public class ToolUtils {
public ToolUtils() {
super();
}
/**
* string转oracle.jbo.domain.date
* @param message
* @return
*/
public static Date stringToJboDate(String message){
Date result = null;
if(!"".equals(message) && message != null){
result = new Date(message);
}
return result;
}
/**
* oracle.jbo.domain.date转string
* @param date
* @return
*/
public static String jboDateToString(Date date){
String result = "";
if(date != null){
result = date.toString();
}
return result;
}
/**
* java.util.Date转oracle.jbo.domain.date
* @param date
* @return
*/
public static Date utilToJbo(java.util.Date date){
Date result = null;
if(date != null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String value = sdf.format(date);
result = stringToJboDate(value);
}
return result;
}
/**
* oracle.jbo.domain.date转java.util.Date
* @param date
* @return
*/
public static java.util.Date jboToUtil(Date date){
java.util.Date result = null;
if(date != null){
String value = jboDateToString(date);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
result = sdf.parse(value);
return result;
} catch (ParseException e) {
e.printStackTrace();
}
}
return result;
}
/**
* oracle.jbo.domain.Number转String
* @param num
* @return
*/
public static String jboNumberToString(oracle.jbo.domain.Number num){
String result = "";
if(num != null){
result = num.toString();
}
return result;
}
/**
* String转oracle.jbo.domain.Number
* @param num
* @return
*/
public static oracle.jbo.domain.Number stringToJboNumber(String message){
oracle.jbo.domain.Number result = null;
if(!"".equals(message) && message != null){
try {
result = new oracle.jbo.domain.Number(message);
} catch (SQLException e) {
e.printStackTrace();
}
}
return result;
}
public static void main(String[] args) {
}
}
ADF中常用各种类型转换
最新推荐文章于 2024-06-19 21:37:07 发布