当前位置: 首页>>代码示例>>Java>>正文


Java ConversionException类代码示例

本文整理汇总了Java中org.apache.ojb.broker.accesslayer.conversions.ConversionException的典型用法代码示例。如果您正苦于以下问题:Java ConversionException类的具体用法?Java ConversionException怎么用?Java ConversionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConversionException类属于org.apache.ojb.broker.accesslayer.conversions包,在下文中一共展示了ConversionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object javaToSql(Object source) throws ConversionException
{
    Object ret;
    if (source == null)
    {
        ret = null;
    }
    else if (source instanceof Long)
    {
        ret = new BigDecimal(((Long) source).doubleValue());
    }
    else
    {
        throw new ConversionException(
                "java-->sql, expected type was"+Long.class.getClass()+
                ", found type "+source.getClass());
    }
    return ret;
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:20,代码来源:FieldConversionTest_4.java

示例2: sqlToJava

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object sqlToJava(Object source) throws ConversionException
{
    Object ret;
    if (source == null)
    {
        ret = null;
    }
    else if (source instanceof BigDecimal)
    {
        ret = new Long(((BigDecimal) source).longValue());
    }
    else
    {
        throw new ConversionException(
                "sql-->java, expected type was"+BigDecimal.class.getClass()+
                ", found type "+source.getClass());
    }
    return ret;
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:20,代码来源:FieldConversionTest_4.java

示例3: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object javaToSql(Object source) throws ConversionException
{
    if(source == null) return null;
    Object ret;
    if (source instanceof Long)
    {
        if (ZERO.equals(source))
        {
ret = NULL_BIG_DECIMAL;
        }
        else
        {
            ret = new BigDecimal(((Long) source).doubleValue());
        }
    }
    else
    {
        throw new ConversionException(
                "java-->sql, expected type was"+Long.class.getClass()+
                ", found type "+source.getClass());
    }
    return ret;
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:24,代码来源:FieldConversionTest_3.java

示例4: sqlToJava

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object sqlToJava(Object source) throws ConversionException
{
    if(source == null) return null;
    Object ret;
    if (source instanceof BigDecimal)
    {
        ret = new Long(((BigDecimal) source).longValue());
    }
    else
    {
        throw new ConversionException(
                "sql-->java, expected type was"+BigDecimal.class.getClass()+
                ", found type "+source.getClass());
    }
    return ret;
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:17,代码来源:FieldConversionTest_3.java

示例5: sqlToJava

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
@Override
public Object sqlToJava(Object arg0) throws ConversionException {
	
	String selectedValues = arg0.toString();
	List<String> aList = new ArrayList<String>();
	
	selectedValues = StringUtils.removeStart(selectedValues, "[");
	selectedValues = StringUtils.removeEnd(selectedValues, "]");
	String[] values = StringUtils.split(selectedValues, ",");
	
	for(String value : values){
		aList.add(StringUtils.strip(value, " ")); // strip whitespace from the start and end
	}
	

	return aList;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:18,代码来源:ListConverter.java

示例6: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
@Override
public Object javaToSql(Object source) throws ConversionException {
    if (source instanceof RelationshipType) {
        if (source != null) {
            RelationshipType relationshipType = (RelationshipType) source;
            return relationshipType.getCode();
        }
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:OjbRelationshipTypeStringConversion.java

示例7: sqlToJava

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
@Override
public Object sqlToJava(Object source) throws ConversionException {
    if (source instanceof String) {
        if (source != null) {
            String s = (String) source;
            for (RelationshipType relType : RelationshipType.values()) {
                if (relType.getCode().equals(s)) {
                    return relType;
                }
            }
        }
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:OjbRelationshipTypeStringConversion.java

示例8: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
@Override
public Object javaToSql(Object source) throws ConversionException {
    if (source instanceof String && ((String) source).contains("who")) {
       return ((String) source).substring(4);
    }
    return source;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:8,代码来源:OLEPrefixConversion.java

示例9: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
/** convert a Java object to its SQL pendant, used for insert & update */
public Object javaToSql(Object source) throws ConversionException
{

    int val = ((Integer) source).intValue();
    val = Integer.MAX_VALUE - val;
    return new Integer(val);
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:9,代码来源:FieldConversionTest_2.java

示例10: sqlToJava

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
/** convert a SQL value to a Java Object, used for SELECT */
public Object sqlToJava(Object source) throws ConversionException
{
    int val = ((Integer) source).intValue();
    val = Integer.MAX_VALUE - val;
    return new Integer(val);
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:8,代码来源:FieldConversionTest_2.java

示例11: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object javaToSql(Object source) throws ConversionException
{
    if (source instanceof String)
    {
        return Double.valueOf((String)source);
    }
    else
    {
        return null;
    }    
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:12,代码来源:FieldTypeTest.java

示例12: sqlToJava

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object sqlToJava(Object source) throws ConversionException
{
    if (source instanceof Double)
    {
        return source.toString();
    }
    else
    {
        return null;
    }
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:12,代码来源:FieldTypeTest.java

示例13: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object javaToSql(Object source) throws ConversionException
{
    if (!(source instanceof ConversionId))
    {
        throw new ConversionException(
                "Wrong java field type when java-->sql, expected " +
                ConversionId.class.getClass() + ", found "
                + source.getClass());
    }
    return ((ConversionId) source).getConversionId();
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:12,代码来源:FieldConversionTest.java

示例14: sqlToJava

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
public Object sqlToJava(Object source) throws ConversionException
{
    if (!(source instanceof Integer))
    {
        throw new ConversionException(
                "Wrong java field type when java-->sql, expected java.lang.Integer, found "
                + source.getClass());
    }
    return new ConversionId((Integer) source);
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:11,代码来源:FieldConversionTest.java

示例15: javaToSql

import org.apache.ojb.broker.accesslayer.conversions.ConversionException; //导入依赖的package包/类
/**
 * @see org.apache.ojb.broker.accesslayer.conversions.FieldConversion#javaToSql(java.lang.Object)
 */
public Object javaToSql(Object source) throws ConversionException {
    if (source != null && source instanceof BigDecimal) {
        BigDecimal converted = (BigDecimal) source;
        return converted;
    }
    else {
        return null;
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:13,代码来源:OjbBudgetConstructionPercentTimeConversion.java


注:本文中的org.apache.ojb.broker.accesslayer.conversions.ConversionException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。