Hello Dimuthu,
Iven't finalized my solution yet.
The first method requires the user to generate the library from the server
side instance. I will elaborate the advantages of this method later in this
thread. The major disadvantage is that the library has to be generated each
time the web services change.
For the second method, I think the best approach would be to return an
instance of a BaseResponse class ( that extends HashMap ). This class can
have a method that will clone the hashmap elements into a model class (
defined by the user ) according to the names of the data members.
Example :
After the method returns the HashMap ( which is the BaseWebResponse class )
will contain ("firstName"-> "Deepak", "lastName"-> "K", 'age'->25)
Suppose the user has defined a new model class called User { private String
firstName, lastName; private int age; //and the accessor methods included }
So the keys of the hashmap can directly correspond to the datamembers. We
can have a Object baseWebResponse.toClassOfType(Class classType) method
within the BaseWebResponse class which will do the conversion.
Thanks,
Deepak
On Mon, Apr 15, 2013 at 10:10 AM, DImuthu Upeksha <
[email protected]> wrote:
> Hi Deepak,
> I was thinking about your two approaches regarding DAO for android client.
> Using dependency injection to create those domain classes makes sense and I
> need to do more reading about dependency injection
> Regarding your second approach, having a generic DAO class and using
> methods like GenericDao.getEntity("Student").getData("getPassedStudents")
> leads to a problem I think. Basically what is the return type of this
> method? It should be a set of Student entities. But we don't have a Student
> class in our application. As a solution we can use a Hashmap like thing to
> return attribute name and value pairs. But I'm not sure about the
> applicability of it because attributes of Student class may have complex
> objects.
>
>
>
> 2013/4/14 Deepak Krishnan <[email protected]>
>
>> 6:53 AM me: Hi Deepak. If you are free I'm available on chat.
>>
>
>
>
> --
> Regards
>
> W.Dimuthu Upeksha
> Undergraduate
> Department of Computer Science And Engineering
>
> University of Moratuwa, Sri Lanka
>
--
Regards,
*Deepak Gopalakrishnan*
*Mobile*:+918891509774
*Skype* : deepakgk87
http://myexps.blogspot.com