Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Add methods to ICurrency
 Post subject: Add methods to ICurrency Post rating: 0   New post Posted: Sun 29 Jun, 2014, 13:57 

User rating: 3
Joined: Mon 23 May, 2011, 16:06
Posts: 17
Location: Hungary,
Dear Support Desk,

May I ask you to add the following two methods to the recetly defined ICurrency interface.
- equals()
- toString()
It would be useful for the users to be sure that toString() returns the ISO 4217 code and equals() is based on that code too, wehenever it exists. In other words, toString() and equals() should be underpinned by the corresponding methods of JFCurrency class rather than those of Object.
If JFCurrency is the only class in the API that implements ICurrency, it's quite a straightforward job for you.

Thank you, regards
Argiris


 
 Post subject: Re: Add methods to ICurrency Post rating: 0   New post Posted: Mon 30 Jun, 2014, 11:32 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
JFCurrency is and will remain the only implementation of the ICurrency interface and it overrides both methods. Repeating java.lang.Object methods in an interface don't enforce its implementations to override them. Thus, such interface change would not be binding for its implementations which would defeat the purpose of the interface concept.
If you are not content with JFCurrency method implementations, please either make JFCurrency change request or make your own custom currency wrapper class.


 
 Post subject: Re: Add methods to ICurrency Post rating: 1   New post Posted: Tue 01 Jul, 2014, 16:54 

User rating: 3
Joined: Mon 23 May, 2011, 16:06
Posts: 17
Location: Hungary,
Sometimes it is worth including methods like toString() and equals() in an interface. In those cases when the author would like to emphasize that these methods are expected to work specifically – differently from those of Object. You can see some examples in the Javadoc of the SE 8 platform.

In your case, that wouldn’t imply real programming job. Only adding the two methods to the ICurrency interface, together with their Javadoc mentioning the ISO 4217 code, as well as adding the @override annotation to the corresponding methods of the JFCurrency class. That’s it.

But I am also happy with your clear statement "JFCurrency is and will remain the only implementation of the ICurrency interface". The short code modification I’d suggest is a kind of formal equivalent of that statement.

Argiris


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com