4 Replies Latest reply on Sep 28, 2011 3:24 PM by Jason Porter

    Property must not be primitive?

    grugrugrunpa Newbie

      Hello.


      i'm using Seam Solder.


      i got a ClassCastException, if i got primitive property value.


      is this spec or not ?


      thanks.



      Environment


      Seam Solder 3.0.0.Final


      Code


      ...
      
      public static class Bean {
           public long longValue = 1;          
           public Long longClassValue = 1L;
      }
           
      private Bean bean = new Bean();
           
      @Test
      public void testInvokePrimitiveReturnType(){
                
           PropertyQuery<Bean> query = PropertyQueries.createQuery(Bean.class);          
           Property<Bean> longValue = query.addCriteria(new NamedPropertyCriteria("longValue")).getFirstResult();
           
           try {
                longValue.getValue(this.bean).getClass().getName();
                Assert.fail("GOOD");
           }
           catch(ClassCastException e){
                e.printStackTrace();
           }
      
           query = PropertyQueries.createQuery(Bean.class);
           Property<Bean> longClassValue = query.addCriteria(new NamedPropertyCriteria("longClassValue")).getFirstResult();          
           System.err.println(longClassValue.getValue(this.bean));
                
      }
      ...