[
Lists Home |
Date Index |
Thread Index
]
- To: "Alaric B. Snell" <alaric@alaric-snell.com>
- Subject: Re: [xml-dev] Distributed versus local processing
- From: Bill de hÓra <bill.dehora@propylon.com>
- Date: Fri, 01 Nov 2002 10:38:41 +0000
- Cc: Paul Prescod <paul@prescod.net>, xml-dev@lists.xml.org
- Organization: Propylon
- References: <36C08A70-E9A2-11D6-9F26-0030657E2F34@mac.com> <E186pZI-0001AB-00@calvin.frontwire.com> <3DC15B34.50809@prescod.net> <E187Jro-0004c2-00@calvin.frontwire.com>
- Reply-to: bill.dehora@propylon.com
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530
Alaric B. Snell wrote:
> But metadata extraction code I've writ for Java looks like:
>
> link = getLinkFromSomewhere () // you missed this out in the HTTP one
>
> Class c = link.getClass ();
>
> boolean idempotent;
>
> try {
> idempotent = c.getField (methodName + "IsIdempotent").getBoolean (link);
> }
> catch (NoSuchFieldException e) {
> // There was no explicit flag, assume not idempotent for now
> idempotent = false;
> }
If the objects implemented an interface, you could just use a cast:
try
{
Idempotent i = (Idempotent)getLinkFromSomewhere ()
...
}
..
and avoid all that reflection verbosity.
> Reflective programming languages make this explicit!
Not as explicit as a cast/classcastexception block - which is what
you're doing deep down.
Bill de hÓra
--
Propylon
www.propylon.com
|