[Carbon-dev] Need a clarification on a code segment used for getting and setting date

Afkham Azeez azeez at wso2.com
Thu Apr 21 05:25:26 PDT 2011


Yeah, better/proper encapsulation.

On Thu, Apr 21, 2011 at 5:44 PM, Supun Kamburugamuva <supun at wso2.com> wrote:

> I think it doesn't want to expose the Data object to the outside?
>
> Thanks,
> Supun..
>
> On Thu, Apr 21, 2011 at 4:57 PM, Amila Maha Arachchi <amilam at wso2.com>
> wrote:
> > Hi,
> >
> > I came across the following code segment.
> >
> > public Date getDate() {
> >         return new Date(date.getTime());
> >     }
> >
> > public void setDate(Date date) {
> >         this.date = new Date(date.getTime());
> >     }
> >
> > Any reason for the above implementation instead of
> >
> > return date; and
> > this.date = date;
> >
> > Thanks,
> > AmilaM.
> >
> > _______________________________________________
> > Carbon-dev mailing list
> > Carbon-dev at wso2.org
> > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >
> >
>
>
>
> --
> Supun Kamburugamuva
> Technical Lead &  Product Manager, WSO2 Inc.; http://wso2.com
> Member, Apache Software Foundation; http://www.apache.org
> WSO2 Inc.;  http://wso2.org
> E-mail: supun at wso2.com;  Mobile: +94 77 431 3585
> Blog: http://supunk.blogspot.com
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev at wso2.org
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>



-- 
*Afkham Azeez*
Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com,
*
*
*Member; Apache Software Foundation;
**http://www.apache.org/*<http://www.apache.org/>
*
email: **azeez at wso2.com* <azeez at wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.wso2.org/pipermail/carbon-dev/attachments/20110421/a457660d/attachment-0001.htm>


More information about the Carbon-dev mailing list