Hi all

I've already converted most of my code from 1.3 to 1.4 , except this
situation :

    Label intToStringLabel = new Label("intToString" , new
PropertyModel(this , "integer")
    {
      @Override
      public Object getObject()
      {
        int value = ((Integer) super.getObject()).intValue();

        switch(value)
        {
          case 1: return "one";
          case 2: return "two";
          case 3: return "three";
        }
        return "";
      }
    });
    add(intToStringLabel);

In the code , I want to output Integer of 1,2,3  to "one" , "two" and
"three"

In the code , PropertyModel is not parameterized , so I change to :
new PropertyModel<Integer>(this , "integer")
and eclipse warns getObject() 's return type should be Integer
But what I want to return is String , not Integer . This doesn't work.

OK , then , I change my code to
new PropertyModel<String>(this , "integer")

and eclipse warns
((Integer) super.getObject()).intValue();
Cannot cast from String to Integer.

I don't know what else can I do , How to parameterize this situation ?

Reply via email to