CustomField getType()


I’ve created CustomField like this:

public class SupListEditor<T> extends CustomField<List<T>>{

What getType method should return to work?

    public Class<? extends List<T>> getType() {
        return (Class<? extends List<T>>) List.class;
//        return (Class<? extends List<T>>) (new ArrayList<T>()).getClass();

Story behind is, that in Eclipse sometimes I get build error if used return from line 3, but it still works afrer trying to build app again, and form works correctly, BUT in Netbeans line 3 gives arror of incompatible types in IDE,
so I found in Vaadin book examples line 4. which gives runtime error (both Eclipse and Netbeans):

[code]$ConversionException: Unable to convert value of type org.eclipse.persistence.internal.indirection.jdk8.IndirectList to presentation type class java.util.List.

[/code]When I swich from EclipseLink to Hibernate nothing really changes, still there is runtime error of same meaning.

Any help?

Try to check all your imports for List. It’s easy to accept a strange import hint from IDE :wink:

And, for me, works following

    public Class<? extends List<T>> getType() {
        Class clazz = List.class;
        return (Class<? extends List<T>>)clazz;

Hi Agata,

Your solution works great, both in Eclipse and Netbeans, build runs without any problems :wink:

Thank you very much good lady :slight_smile: