Re: self()
Per Nyfelt <[email protected]> Wed, 29 Jun 2005 17:38:16 +0200
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Organization | Resourcing Networks |
| Message-ID | <[email protected]> |
A bit overkill actually. You do not need to replace this with self() if when
you are using this to determine the scope but only when used as a parameter
representing the object instance. Something like the following will be easier
to read:
public void setBank(java.lang.String accountNumber,
se.snigel.ozone.Bank bank) {
if (bank != null) &&
bank.getBankAccounts().containsKey
(accountNumber)) {
bank.getBankAccounts().remove(accountNumber);
}
this.bank = bank;
if ((bank != null) &&
!this.equals(bank.getBankAccounts().get(accountNumber))) {
bank.getBankAccounts().put(accountNumber, self());
}
}
Regards,
Per
Wednesday 29 June 2005 02.02 skrev Karl Wettin:
> I'm not quite sure on how much I should use self(). For now I use it
> everywhere. Is that crazy or just about right?
>
>
> public void setBank(java.lang.String accountNumber,
> se.snigel.ozone.Bank bank) {
> if ((self().bank != null) &&
> self().bank.getBankAccounts().containsKey
> (accountNumber)) {
> self().bank.getBankAccounts().remove(accountNumber);
> }
>
> self().bank = bank;
>
> if ((bank != null) &&
> !self().equals(bank.getBankAccounts().get
> (accountNumber))) {
> bank.getBankAccounts().put(accountNumber, self());
> }
> }
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click