[Home] [By Thread] [By Date] [Recent Entries]

  • To: "Alaric B. Snell" <alaric@a...>
  • Subject: Re: Distributed versus local processing
  • From: Bill de hÓra <bill.dehora@p...>
  • Date: Fri, 01 Nov 2002 10:38:41 +0000
  • Cc: Paul Prescod <paul@p...>, xml-dev@l...
  • Organization: Propylon
  • References: <36C08A70-E9A2-11D6-9F26-0030657E2F34@m...> <E186pZI-0001AB-00@c...> <3DC15B34.50809@p...> <E187Jro-0004c2-00@c...>
  • Reply-to: bill.dehora@p...
  • 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


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member