← Back to team overview

mugle-dev team mailing list archive

GameViewServiceImpl and ModelWrapper

 

Hi guys,

I think Scott is responsible for GameViewServiceImpl (platform branch) and
Prageeth for ModelWrapper.

I am trying to debug GameViewServiceImpl.java in the platform branch. It
still isn't compiling for me.

First, what is this toReturn thing? It looks like a temporary array used to
build up values before they are returned from various methods. Why is it an
instance variable? If I call any of those methods more than once (or more
than one of them) with the same instance of GameViewService, won't I see a
build-up of values in the array (I'll get all the previous values, THEN all
the new ones)? I don't get why it isn't a local variable in each of those
methods.

Probably currentUser should be the same. Is that an instance variable for
any reason? What happens if the user logs out but stays on the same page?
Won't GameViewServiceImpl keep a handle on the old user account? This seems
dangerous. In general, service classes should not have instance variables
unless they are stateless themselves (i.e., other impl objects like
UserViewServiceImpl).

Secondly, I just don't get this type error. It's telling me that the result
of the call to ModelWrapper.getClientClone is of type T and this cannot be
cast to Object. I would have thought anything of type T can be cast to
Object but .. well I just don't get the type of getClientClone. Prageeth,
can you explain it for me:

    public static <T extends ModelClass<?,T>, U extends
ModelDataClass<?,T,U>>
        T getClientClone(U obj, Role role, ClientView cview)

I don't see how T can extend ModelClass<?, T> ... how can it be a subclass
of a class which contains itself as an argument? Hmm ... I vaguely get this.
Am I right that this is what you intended?

Do you have any successful examples of using this class? I can't make it
work (I can't cast the result to Object, which is what Scott is trying to
do).