/** * Checks whether the passed type binding is a runtime exception. * * @param thrownException the type binding * * @return <code>true</code> if the passed type binding is a runtime exception; * otherwise <code>false</code> is returned */ public static boolean isRuntimeException(ITypeBinding thrownException) { if (thrownException == null || thrownException.isPrimitive() || thrownException.isArray()) return false; return findTypeInHierarchy(thrownException, "java.lang.RuntimeException") != null; //$NON-NLS-1$ }
/** * Checks whether the passed type binding is a runtime exception. * * @param thrownException the type binding * * @return <code>true</code> if the passed type binding is a runtime exception; * otherwise <code>false</code> is returned */ public static boolean isRuntimeException(ITypeBinding thrownException) { if (thrownException == null || thrownException.isPrimitive() || thrownException.isArray()) return false; return findTypeInHierarchy(thrownException, "java.lang.RuntimeException") != null; //$NON-NLS-1$ }
/** * Checks whether the passed type binding is a runtime exception. * * @param thrownException the type binding * * @return <code>true</code> if the passed type binding is a runtime exception; * otherwise <code>false</code> is returned */ public static boolean isRuntimeException(ITypeBinding thrownException) { if (thrownException == null || thrownException.isPrimitive() || thrownException.isArray()) return false; return findTypeInHierarchy(thrownException, "java.lang.RuntimeException") != null; //$NON-NLS-1$ }
/** * Searches for a type binding for a given fully qualified type in the hierarchy of a type. * Returns the immediate super type in whose supertype hierarchy the given type appears, or <code>null</code> if no type binding is found. * @param hierarchyType the binding representing the hierarchy * @param fullyQualifiedTypeName the fully qualified name to search for * @return the type binding */ public static ITypeBinding findImmediateSuperTypeInHierarchy(ITypeBinding hierarchyType, String fullyQualifiedTypeName) { if (hierarchyType.isArray() || hierarchyType.isPrimitive()) { return null; } ITypeBinding superClass= hierarchyType.getSuperclass(); if (superClass != null) { ITypeBinding res= findTypeInHierarchy(superClass, fullyQualifiedTypeName); if (res != null) { return superClass; } } ITypeBinding[] superInterfaces= hierarchyType.getInterfaces(); for (int i= 0; i < superInterfaces.length; i++) { ITypeBinding res= findTypeInHierarchy(superInterfaces[i], fullyQualifiedTypeName); if (res != null) { return superInterfaces[i]; } } return null; }
/** * Searches for a type binding for a given fully qualified type in the hierarchy of a type. * Returns the immediate super type in whose supertype hierarchy the given type appears, or <code>null</code> if no type binding is found. * @param hierarchyType the binding representing the hierarchy * @param fullyQualifiedTypeName the fully qualified name to search for * @return the type binding */ public static ITypeBinding findImmediateSuperTypeInHierarchy(ITypeBinding hierarchyType, String fullyQualifiedTypeName) { if (hierarchyType.isArray() || hierarchyType.isPrimitive()) { return null; } ITypeBinding superClass= hierarchyType.getSuperclass(); if (superClass != null) { ITypeBinding res= findTypeInHierarchy(superClass, fullyQualifiedTypeName); if (res != null) { return superClass; } } ITypeBinding[] superInterfaces= hierarchyType.getInterfaces(); for (int i= 0; i < superInterfaces.length; i++) { ITypeBinding res= findTypeInHierarchy(superInterfaces[i], fullyQualifiedTypeName); if (res != null) { return superInterfaces[i]; } } return null; }
ITypeBinding res= findTypeInHierarchy(superClass, fullyQualifiedTypeName); if (res != null) { return res; ITypeBinding res= findTypeInHierarchy(superInterfaces[i], fullyQualifiedTypeName); if (res != null) { return res;
/** * Finds a type binding for a given fully qualified type in the hierarchy of a type. * Returns <code>null</code> if no type binding is found. * @param hierarchyType the binding representing the hierarchy * @param fullyQualifiedTypeName the fully qualified name to search for * @return the type binding */ public static ITypeBinding findTypeInHierarchy(ITypeBinding hierarchyType, String fullyQualifiedTypeName) { if (hierarchyType.isArray() || hierarchyType.isPrimitive()) { return null; } if (fullyQualifiedTypeName.equals(hierarchyType.getTypeDeclaration().getQualifiedName())) { return hierarchyType; } ITypeBinding superClass= hierarchyType.getSuperclass(); if (superClass != null) { ITypeBinding res= findTypeInHierarchy(superClass, fullyQualifiedTypeName); if (res != null) { return res; } } ITypeBinding[] superInterfaces= hierarchyType.getInterfaces(); for (int i= 0; i < superInterfaces.length; i++) { ITypeBinding res= findTypeInHierarchy(superInterfaces[i], fullyQualifiedTypeName); if (res != null) { return res; } } return null; }
/** * Finds a type binding for a given fully qualified type in the hierarchy of a type. * Returns <code>null</code> if no type binding is found. * @param hierarchyType the binding representing the hierarchy * @param fullyQualifiedTypeName the fully qualified name to search for * @return the type binding */ public static ITypeBinding findTypeInHierarchy(ITypeBinding hierarchyType, String fullyQualifiedTypeName) { if (hierarchyType.isArray() || hierarchyType.isPrimitive()) { return null; } if (fullyQualifiedTypeName.equals(hierarchyType.getTypeDeclaration().getQualifiedName())) { return hierarchyType; } ITypeBinding superClass= hierarchyType.getSuperclass(); if (superClass != null) { ITypeBinding res= findTypeInHierarchy(superClass, fullyQualifiedTypeName); if (res != null) { return res; } } ITypeBinding[] superInterfaces= hierarchyType.getInterfaces(); for (int i= 0; i < superInterfaces.length; i++) { ITypeBinding res= findTypeInHierarchy(superInterfaces[i], fullyQualifiedTypeName); if (res != null) { return res; } } return null; }
if (Bindings.findTypeInHierarchy(expressionType, "java.lang.Iterable") != null) { //$NON-NLS-1$ if (resultingCollections == null) return true; resultingCollections.add(new GenerateForLoopAssistProposal(cu, expressionStatement, GenerateForLoopAssistProposal.GENERATE_ITERATOR_FOR)); if (Bindings.findTypeInHierarchy(expressionType, "java.util.List") != null) { //$NON-NLS-1$ resultingCollections.add(new GenerateForLoopAssistProposal(cu, expressionStatement, GenerateForLoopAssistProposal.GENERATE_ITERATE_LIST));
ITypeBinding objectBinding= Bindings.findTypeInHierarchy(binding, "java.lang.Object"); //$NON-NLS-1$ if (objectBinding != null) { getDelegatableMethods(methods, fieldBinding, objectBinding, binding, result);
ITypeBinding objectBinding= Bindings.findTypeInHierarchy(binding, "java.lang.Object"); //$NON-NLS-1$ if (objectBinding != null) { getDelegatableMethods(methods, fieldBinding, objectBinding, binding, result);
if (Bindings.findTypeInHierarchy(expressionType, "java.lang.Iterable") != null) { //$NON-NLS-1$ if (resultingCollections == null) return true; resultingCollections.add(new GenerateForLoopAssistProposal(cu, expressionStatement, GenerateForLoopAssistProposal.GENERATE_ITERATOR_FOR)); if (Bindings.findTypeInHierarchy(expressionType, "java.util.List") != null) { //$NON-NLS-1$ resultingCollections.add(new GenerateForLoopAssistProposal(cu, expressionStatement, GenerateForLoopAssistProposal.GENERATE_ITERATE_LIST));
superType= superType.substring(0, i); superTypeBinding= Bindings.findTypeInHierarchy(typeBinding, superType);
superType= superType.substring(0, i); superTypeBinding= Bindings.findTypeInHierarchy(typeBinding, superType);
expressionTypeBinding = expBinding.getElementType(); } else { ITypeBinding iterable = Bindings.findTypeInHierarchy(expBinding, "java.lang.Iterable"); //$NON-NLS-1$ if (iterable != null) { ITypeBinding[] typeArguments = iterable.getTypeArguments();
ITypeBinding initializerListType= Bindings.findTypeInHierarchy(initializerTypeBinding, "java.util.List"); //$NON-NLS-1$ ITypeBinding initializerIterableType= Bindings.findTypeInHierarchy(initializerTypeBinding, "java.lang.Iterable"); //$NON-NLS-1$
expressionTypeBinding= expBinding.getElementType(); } else { ITypeBinding iterable= Bindings.findTypeInHierarchy(expBinding, "java.lang.Iterable"); //$NON-NLS-1$ if (iterable != null) { ITypeBinding[] typeArguments= iterable.getTypeArguments();
elementBinding= typeBinding.getElementType(); } else { ITypeBinding iterable= Bindings.findTypeInHierarchy(typeBinding, "java.lang.Iterable"); //$NON-NLS-1$ if (iterable != null) { ITypeBinding[] typeArguments= iterable.getTypeArguments();
elementBinding= typeBinding.getElementType(); } else { ITypeBinding iterable= Bindings.findTypeInHierarchy(typeBinding, "java.lang.Iterable"); //$NON-NLS-1$ if (iterable != null) { ITypeBinding[] typeArguments= iterable.getTypeArguments();
elementBinding= typeBinding.getElementType(); } else { ITypeBinding iterable= Bindings.findTypeInHierarchy(typeBinding, "java.lang.Iterable"); //$NON-NLS-1$ if (iterable != null) { ITypeBinding[] typeArguments= iterable.getTypeArguments();