Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create a ValueProxy

I am trying to create a ValueProxy which holds some basic information about a search a user is performing. For some reason GWT wants it to be an EntityProxy but I dont see why (nor does it make sense for this class to be an EntityProxy).

// FilterProxy extends ValueProxy
@ProxyFor(DayFilter.class)
public interface DayFilterProxy extends FilterProxy {

    void setFilterValue(Date day);
    Date getFilterValue();
}

public class DayFilter extends Filter {

    public DayFilter() {
        setOperator(FilterOperator.GREATER_THAN_OR_EQUAL);
        setField("dateRequested");
    }

    public void setFilterValue(Date date) {
        this.value = date;
    }

    public Date getFilterValue() {
        return value;
    }
}

public interface PaginationRequest<T> extends RequestContext {

    Request<List<T>> paginate(int offset, int limit, String sortColumn,
            boolean isSortAscending, List<FilterProxy> filters);

    Request<Integer> count(List<FilterProxy> filters);
}

@Service(value=TripService.class, locator=SchedgyServiceLocator.class)
public interface TripRequest extends PaginationRequest<TripProxy> {

    Request<TripProxy> save(TripProxy trip);
}

Within the activity that is sending this back to the server:

// Request is a TripRequest
DayFilterProxy filter = request.create(DayFilterProxy.class);

This results in:

java.lang.AssertionError: com.schedgy.trip.dao.filter.trip.proxy.DayFilterProxy is not an EntityProxy type
    at com.google.web.bindery.requestfactory.shared.impl.IdFactory.asEntityProxy(IdFactory.java:66)
    at com.google.web.bindery.requestfactory.shared.impl.IdFactory.createId(IdFactory.java:229)
    at com.google.web.bindery.requestfactory.shared.impl.IdFactory.allocateId(IdFactory.java:41)
    at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.create(AbstractRequestContext.java:478)
    at com.schedgy.trip.client.activity.TripsActivity.getFilters(TripsActivity.java:56)

Any ideas? Its got to be something obvious that I am just overlooking as I have ValueProxies working elsewhere in the code.

like image 938
Brad Avatar asked Sep 01 '11 04:09

Brad


1 Answers

Could it be that your DayFilterProxy is not referenced at all from the RequestContext?

like image 66
Thomas Broyer Avatar answered Sep 28 '22 14:09

Thomas Broyer