public class PointConverter extends DefaultTypeConverter{
public Object convertValue(Map context, Object value, Class toType) {
// TODO Auto-generated method stub
 
if(Point.class==toType)
{

Point point = new Point();
String[] str = (String[])value;
String[]paraValues = str[0].split(",");
int x = Integer.parseInt(paraValues[0]);
int y = Integer.parseInt(paraValues[1]);
point.setX(x);
point.setY(y);
return point;
}
if(String.class==toType)
{
Point point =(Point)value;
int x = point.getX();
int y = point.getY();
String result = "[x=" + x + "," + "y=" + y + "]";
return result;
}
return null;
}
}
请问,if(Point.class==toType)这个什么意思,是说,将要转成的类型是Point ?
将要转成的类型怎么能拿来当if条件呢?迷茫!
这个是转换类型用的,怎么能判断一个类型将要转成的类型是什么呢?只能说它原来的类型是什么,然后才能用if判断吧。
请指点,谢谢!