velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henning P. Schmiedehausen" <...@intermeta.de>
Subject Re: Problem getting value from Map.
Date Fri, 06 Oct 2006 20:20:31 GMT
"Daryl Beattie" <DarylB@date.com> writes:

>class DataHolder extends HashMap<Name, Value> {

>  public Value getA() {
>    return this.get(new Name("a")); //$NON-NLS-1$
>  }

>  @Override
>  public Value get(Object key) {
>    return super.get(new Name(key.toString()));
>  }
>}

Quick question: Shouldn't that be

public Value getA() {
  return super.get(new Name("a")); //$NON-NLS-1$
}

In your case, calling getA() ends up being

super.get(new Name(new Name("a").toString()));

If new Name("a").toString() != "a", then it is understandable why
$bo.A works and $bo.get("a") not.

	Best regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

Social behaviour: Bavarians can be extremely egalitarian and folksy.
                                    -- http://en.wikipedia.org/wiki/Bavaria
Most Franconians do not like to be called Bavarians.
                                    -- http://en.wikipedia.org/wiki/Franconia

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message