public boolean hasField(String name) { for (Field field : clazz.getDeclaredFields()) { if (field.getName().equals(name)) { return true; } } for (ResolvedReferenceType ancestor : typeDeclaration.getAllAncestors()) { if (ancestor.getTypeDeclaration().hasField(name)) { return true; } } return false; }
public List<ResolvedFieldDeclaration> getAllFields() { ArrayList<ResolvedFieldDeclaration> fields = new ArrayList<>(); for (Field field : clazz.getDeclaredFields()) { fields.add(new ReflectionFieldDeclaration(field, typeSolver)); } for (ResolvedReferenceType ancestor : typeDeclaration.getAllAncestors()) { fields.addAll(ancestor.getTypeDeclaration().getAllFields()); } return fields; }
public List<ResolvedFieldDeclaration> getAllFields() { ArrayList<ResolvedFieldDeclaration> fields = new ArrayList<>(); for (Field field : clazz.getDeclaredFields()) { fields.add(new ReflectionFieldDeclaration(field, typeSolver)); } for (ResolvedReferenceType ancestor : typeDeclaration.getAllAncestors()) { fields.addAll(ancestor.getTypeDeclaration().getAllFields()); } return fields; }
public List<ResolvedFieldDeclaration> getAllFields() { ArrayList<ResolvedFieldDeclaration> fields = new ArrayList<>(); for (Field field : clazz.getDeclaredFields()) { fields.add(new ReflectionFieldDeclaration(field, typeSolver)); } for (ResolvedReferenceType ancestor : typeDeclaration.getAllAncestors()) { fields.addAll(ancestor.getTypeDeclaration().getAllFields()); } return fields; }
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other) { List<ResolvedReferenceType> ancestorsOfOther = other.getAllAncestors(); ancestorsOfOther.add(new ReferenceTypeImpl(other, typeSolver)); for (ResolvedReferenceType ancestorOfOther : ancestorsOfOther) { if (ancestorOfOther.getQualifiedName().equals(this.getQualifiedName())) { return true; } } return false; }
public List<ResolvedReferenceType> getAllAncestors() { // We need to go through the inheritance line and propagate the type parametes List<ResolvedReferenceType> ancestors = typeDeclaration.getAllAncestors(); ancestors = ancestors.stream() .map(a -> typeParametersMap().replaceAll(a).asReferenceType()) .collect(Collectors.toList()); // Avoid repetitions of Object ancestors.removeIf(a -> a.getQualifiedName().equals(Object.class.getCanonicalName())); ResolvedReferenceTypeDeclaration objectType = typeSolver.solveType(Object.class.getCanonicalName()); ResolvedReferenceType objectRef = create(objectType); ancestors.add(objectRef); return ancestors; }
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other) { List<ResolvedReferenceType> ancestorsOfOther = other.getAllAncestors(); ancestorsOfOther.add(new ReferenceTypeImpl(other, typeSolver)); for (ResolvedReferenceType ancestorOfOther : ancestorsOfOther) { if (ancestorOfOther.getQualifiedName().equals(this.getQualifiedName())) { return true; } } return false; }
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other) { List<ResolvedReferenceType> ancestorsOfOther = other.getAllAncestors(); ancestorsOfOther.add(new ReferenceTypeImpl(other, typeSolver)); for (ResolvedReferenceType ancestorOfOther : ancestorsOfOther) { if (ancestorOfOther.getQualifiedName().equals(this.getQualifiedName())) { return true; } } return false; }
public List<ResolvedReferenceType> getAllAncestors() { // We need to go through the inheritance line and propagate the type parametes List<ResolvedReferenceType> ancestors = typeDeclaration.getAllAncestors(); ancestors = ancestors.stream() .map(a -> typeParametersMap().replaceAll(a).asReferenceType()) .collect(Collectors.toList()); // Avoid repetitions of Object ancestors.removeIf(a -> a.getQualifiedName().equals(Object.class.getCanonicalName())); ResolvedReferenceTypeDeclaration objectType = typeSolver.solveType(Object.class.getCanonicalName()); ResolvedReferenceType objectRef = create(objectType); ancestors.add(objectRef); return ancestors; }
public List<ResolvedReferenceType> getAllAncestors() { // We need to go through the inheritance line and propagate the type parametes List<ResolvedReferenceType> ancestors = typeDeclaration.getAllAncestors(); ancestors = ancestors.stream() .map(a -> typeParametersMap().replaceAll(a).asReferenceType()) .collect(Collectors.toList()); // Avoid repetitions of Object ancestors.removeIf(a -> a.getQualifiedName().equals(Object.class.getCanonicalName())); ResolvedReferenceTypeDeclaration objectType = typeSolver.solveType(Object.class.getCanonicalName()); ResolvedReferenceType objectRef = create(objectType); ancestors.add(objectRef); return ancestors; }
public ResolvedFieldDeclaration getField(String name) { for (Field field : clazz.getDeclaredFields()) { if (field.getName().equals(name)) { return new ReflectionFieldDeclaration(field, typeSolver); } } for (ResolvedReferenceType ancestor : typeDeclaration.getAllAncestors()) { if (ancestor.getTypeDeclaration().hasField(name)) { ReflectionFieldDeclaration reflectionFieldDeclaration = (ReflectionFieldDeclaration) ancestor.getTypeDeclaration().getField(name); return reflectionFieldDeclaration.replaceType(ancestor.getFieldType(name).get()); } } throw new UnsolvedSymbolException(name, "Field in " + this); }
public ResolvedFieldDeclaration getField(String name) { for (Field field : clazz.getDeclaredFields()) { if (field.getName().equals(name)) { return new ReflectionFieldDeclaration(field, typeSolver); } } for (ResolvedReferenceType ancestor : typeDeclaration.getAllAncestors()) { if (ancestor.getTypeDeclaration().hasField(name)) { ReflectionFieldDeclaration reflectionFieldDeclaration = (ReflectionFieldDeclaration) ancestor.getTypeDeclaration().getField(name); return reflectionFieldDeclaration.replaceType(ancestor.getFieldType(name).get()); } } throw new UnsolvedSymbolException(name, "Field in " + this); }
public ResolvedFieldDeclaration getField(String name) { for (Field field : clazz.getDeclaredFields()) { if (field.getName().equals(name)) { return new ReflectionFieldDeclaration(field, typeSolver); } } for (ResolvedReferenceType ancestor : typeDeclaration.getAllAncestors()) { if (ancestor.getTypeDeclaration().hasField(name)) { ReflectionFieldDeclaration reflectionFieldDeclaration = (ReflectionFieldDeclaration) ancestor.getTypeDeclaration().getField(name); return reflectionFieldDeclaration.replaceType(ancestor.getFieldType(name).get()); } } throw new UnsolvedSymbolException(name, "Field in " + this); }
ancestors = currentClass.resolve().getAllAncestors(); } catch (InvalidPathException | UnsolvedSymbolException i) { ancestors = getAllAncestors(currentClass.resolve());
ancestors = currentClass.resolve().getAllAncestors(); } catch (UnsolvedSymbolException u) { ancestors = RefactoringHelper.getAllAncestors(currentClass.resolve());
ancestors = currentClass.resolve().getAllAncestors(); } catch (UnsolvedSymbolException u) { ancestors = RefactoringHelper.getAllAncestors(currentClass.resolve());