PDA

View Full Version : @BEAN Type BEAN cannot be resolved to a type (JAVA Compilation error)



infocorrea
4 Apr 2012, 9:24 AM
I want to use BeanModelMarker instead to modify my POJOS. I'm new and I'm following the example in the book. But I have an error when I intent to use the annotation, perhaps I forgot to include any library?
But up to now I run other examples with GXT and it was fine.
My code is:
My POJO:



public class Feed implements Serializable {
private String uuid;
public Feed()
{
}
public Feed(String uuid)
{
this.uuid = uuid;
}
public String getDescription() {
return description;
}....


package com.treselementos.rssreader.client.model;


import com.extjs.gxt.ui.client.data.BeanModelMarker;
import com.treselementos.rssreader.shared.model.Feed;


@BEAN(Feed.class)
public interface FeedBeanModel extends BeanModelMarker {

}

Colin Alworth
4 Apr 2012, 11:45 AM
The BEAN annotation is at com.extjs.gxt.ui.client.data.BeanModelMarker.BEAN, make sure you have an import for that class.

And this is unlikely to be the problem, but make sure that you are using JDK5 or above, as annotations are not supported in earlier versions of Java.

Moving this thread to the 2.x Q&A - and if you are starting a new project, consider using GXT 3 instead - the BEAN and BeanModelMarker code is not needed with 3.0.

infocorrea
9 Apr 2012, 3:36 AM
The error persists and I dont' know what is happened...The JDK is version 6.
My Java Build Path includes:
GWT 2.4.0
GXT 2.2.5
and jre 6
any help? Because people have recommend me, move to GXT 3 but I see a lack of documentation and I'll try first to understand the concepts.Thank you!

infocorrea
9 Apr 2012, 4:05 AM
I think all of it is the same problem cause now I had implemented a bean that implement BeanModelTag and I lget the error at runtime....

shingocat
9 May 2012, 5:13 AM
looking like as follow:

package com.treselementos.rssreader.client.model;


import com.extjs.gxt.ui.client.data.BeanModelMarker;
import com.treselementos.rssreader.shared.model.Feed;
import com.extjs.gxt.ui.client.data.BeanModelMarker.BEAN; //you don't import this line, that is why you get exception.

@BEAN(Feed.class)
public interface FeedBeanModel extends BeanModelMarker {

}

victoreadward
29 May 2012, 11:34 AM
How could we use Java Beans as BeanModel at GXT3?

Colin Alworth
29 May 2012, 5:11 PM
There is no need to use BeanModel with GXT 3, since 3 doesn't require ModelData at all. Instead, all GXT 3 data widgets use the ValueProvider interface to read values from models, and write them back if required.

In the case of a bean-like object with getter and setter methods, the ValueProvider interface doesn't need to be manually implemented, but instances can be generated. Check out the GXT 3 examples such as http://www.sencha.com/examples/#ExamplePlace:basicgrid to see what this looks like (click the source tab and take a look at the Stock.java and StockProperties.java files).