commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject RE: [jelly] double checking my logic
Date Mon, 07 Nov 2005 02:37:38 GMT
Not exactly.  The only class that evaluates to true for
isAssignableFrom(Object.class) is Object itself.  That if statement could
probably be rewritten a bit more clearly as:

if(type != null && 
   type.isAssignableFrom(Expression.class) && 
   type != Object.class)
{
}

Basically, it's checking to see if "type" is the same as or a
superclass/superinterface (other than Object) of Expression.  So, type ==
Expression.class would cause the expression to evaluate to true and the body
of the if statement to execute.

-----Original Message-----
From: Hans Gilde [mailto:hgilde@gmail.com] 
Sent: Sunday, November 06, 2005 8:57 PM
To: 'Jakarta Commons Developers List'
Subject: [jelly] double checking my logic

Just to be sure I'm not missing something. the following if condition
couldn't possible execute:

 

if (type != null && type.isAssignableFrom(Expression.class) &&
!type.isAssignableFrom(Object.class)) 

 

The reason being that anything that isAssignableFrom(Expression.class) also
isAssignableFrom(Object.class)

 

right?

 

Hans




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


Mime
View raw message