@param type the ClassNode of interest @return true if this node is derived from the given ClassNode
(ClassNode type)
| 1319 | * @return true if this node is derived from the given ClassNode |
| 1320 | */ |
| 1321 | public boolean isDerivedFrom(ClassNode type) { |
| 1322 | if (ClassHelper.isPrimitiveVoid(this)) { |
| 1323 | return ClassHelper.isPrimitiveVoid(type); |
| 1324 | } |
| 1325 | if (ClassHelper.isObjectType(type)) { |
| 1326 | return true; |
| 1327 | } |
| 1328 | if (this.isArray() && type.isArray() |
| 1329 | && ClassHelper.isObjectType(type.getComponentType()) |
| 1330 | && !ClassHelper.isPrimitiveType(this.getComponentType())) { |
| 1331 | return true; |
| 1332 | } |
| 1333 | for (ClassNode node = this; node != null; node = node.getSuperClass()) { |
| 1334 | if (type.equals(node)) { |
| 1335 | return true; |
| 1336 | } |
| 1337 | } |
| 1338 | return false; |
| 1339 | } |
| 1340 | |
| 1341 | /** |
| 1342 | * Returns whether this {@link ClassNode} represents a type that implements the {@code GroovyObject} interface. |