|
Hi,
This is a bit OffTopic. I have
written following overloaded methods.
private boolean validate(Tag tag, Object
value)
private boolean validate(Tag tag, Number
value)
private boolean validate(Tag tag, String
value)
private boolean validate(Tag tag, Boolean
value)
The invoking code is in the same class. The relevant part is given
below
Set set =
valuesMap.entrySet();
Iterator itr = set.iterator(); String tagname, msg; Object value, tag; Map.Entry entry; Tag t; boolean valid; while (itr.hasNext()) { entry = (Map.Entry) itr.next(); tagname = (String) entry.getKey(); value = entry.getValue(); tag = tagMap.get(tagname); file://if
not null and valid, then remove it from the valuesMap and send for
writing
if ((tag != null) && (value != null) && validate((Tag) tag, value)) { file://do something
}
I am having an entry in the map as "name"=Float .
At execution time, I expected the method validate(Tag, Number) to be invoked
rather than validate(Tag, Object). But I observed that validate(Tag, Object) was
invoked. I am confused by this behaviour. Am I missing something ?
TIA,
-sourabh
----
Sourabh Kulkarni Embedded Systems Group. rapidEffect (P) Ltd.25,Napier Road, Pune 411 001 Tel./Fax. +91-20-6363250 |
- Re: OffTopic - strange overloaded method behaviour Sourabh Kulkarni
- Re: OffTopic - strange overloaded method behaviour Paul Balanoiu
- Re: OffTopic - strange overloaded method behavio... Sourabh Kulkarni
- Re: OffTopic - strange overloaded method behaviour jose
- Re: OffTopic - strange overloaded method behaviour Kumar Sameer
- Re: OffTopic - strange overloaded method behavio... Sourabh Kulkarni
