package com.text.converter;import java.util.Map;import ognl.DefaultTypeConverter;
import com.text.model.Point;public class pointconverter extends DefaultTypeConverter {
public Object convertValue(Map context, Object value, Class toType) {
// TODO Auto-generated method stub
if(Point .class = = toType)
{
Point p=new Point();

}
}
}
if(Point .class = = toType)这段老是红的 和我对照的教程一样 怎么回事

解决方案 »

  1.   

    Point .class  你这里好像有空格耶!
      

  2.   

    if(Point .class = = toType)两个等号之间不要有空格if(Point .class == toType)
      

  3.   

    类型不一样。
    一个是class 一个是Class
    Test.class.getClass()这样试试?
      

  4.   

    if(Point.class instanceof toType)? 不对啊
      

  5.   

    package com.text.converter;import java.util.Map;import ognl.DefaultTypeConverter;
    import com.text.model.Point;public class pointconverter extends DefaultTypeConverter {private String Point;
    public Object convertValue(Map context, Object value, Class toType) {
    // TODO Auto-generated method stub
    if(Point .class = = toType)
    {
    Point p=new Point();}
    }}