本文整理汇总了Java中net.floodlightcontroller.storage.TypeMismatchStorageException类的典型用法代码示例。如果您正苦于以下问题:Java TypeMismatchStorageException类的具体用法?Java TypeMismatchStorageException怎么用?Java TypeMismatchStorageException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeMismatchStorageException类属于net.floodlightcontroller.storage包,在下文中一共展示了TypeMismatchStorageException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShortObject
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Short getShortObject(String columnName)
{
Short s;
Object obj = getObject(columnName);
if (obj instanceof Short) {
s = (Short)obj;
} else if (obj != null) {
try {
s = Short.parseShort(obj.toString());
}
catch (NumberFormatException exc) {
throw new TypeMismatchStorageException(Short.class.getName(), obj.getClass().getName(), columnName);
}
} else {
s = null;
}
return s;
}
示例2: getIntegerObject
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Integer getIntegerObject(String columnName)
{
Integer i;
Object obj = getObject(columnName);
if (obj instanceof Integer) {
i = (Integer)obj;
} else if (obj != null) {
try {
i = Integer.parseInt(obj.toString());
}
catch (NumberFormatException exc) {
throw new TypeMismatchStorageException(Integer.class.getName(), obj.getClass().getName(), columnName);
}
} else {
i = null;
}
return i;
}
示例3: getLongObject
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Long getLongObject(String columnName)
{
Long l;
Object obj = getObject(columnName);
if (obj instanceof Long) {
l = (Long)obj;
} else if (obj != null) {
try {
l = Long.parseLong(obj.toString());
}
catch (NumberFormatException exc) {
throw new TypeMismatchStorageException(Long.class.getName(), obj.getClass().getName(), columnName);
}
} else {
l = null;
}
return l;
}
示例4: getFloatObject
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Float getFloatObject(String columnName)
{
Float f;
Object obj = getObject(columnName);
if (obj instanceof Float) {
f = (Float)obj;
} else if (obj != null) {
try {
f = Float.parseFloat(obj.toString());
}
catch (NumberFormatException exc) {
throw new TypeMismatchStorageException(Float.class.getName(), obj.getClass().getName(), columnName);
}
} else {
f = null;
}
return f;
}
示例5: getDoubleObject
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Double getDoubleObject(String columnName)
{
Double d;
Object obj = getObject(columnName);
if (obj instanceof Double) {
d = (Double)obj;
} else if (obj != null) {
try {
d = Double.parseDouble(obj.toString());
}
catch (NumberFormatException exc) {
throw new TypeMismatchStorageException(Double.class.getName(), obj.getClass().getName(), columnName);
}
} else {
d = null;
}
return d;
}
示例6: getBooleanObject
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Boolean getBooleanObject(String columnName)
{
Boolean b;
Object obj = getObject(columnName);
if (obj instanceof Boolean) {
b = (Boolean)obj;
} else if (obj != null) {
try {
b = Boolean.parseBoolean(obj.toString());
}
catch (NumberFormatException exc) {
throw new TypeMismatchStorageException(Boolean.class.getName(), obj.getClass().getName(), columnName);
}
} else {
b = null;
}
return b;
}
示例7: getByteObject
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Byte getByteObject(String columnName)
{
Byte b;
Object obj = getObject(columnName);
if (obj instanceof Byte) {
b = (Byte)obj;
} else if (obj != null) {
try {
b = Byte.parseByte(obj.toString());
}
catch (NumberFormatException exc) {
throw new TypeMismatchStorageException(Byte.class.getName(), obj.getClass().getName(), columnName);
}
} else {
b = null;
}
return b;
}
示例8: getDate
import net.floodlightcontroller.storage.TypeMismatchStorageException; //导入依赖的package包/类
@Override
public Date getDate(String column) {
Date d;
Object obj = getObject(column);
if (obj == null) {
d = null;
} else if (obj instanceof Date) {
d = (Date) obj;
} else {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
d = dateFormat.parse(obj.toString());
}
catch (ParseException exc) {
throw new TypeMismatchStorageException(Date.class.getName(), obj.getClass().getName(), column);
}
}
return d;
}