< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java

Print this page




 196                 .collect(Collectors.<Element, List<Element>>toCollection(ArrayList::new));
 197         return excludeList;
 198     }
 199 
 200     /**
 201      * Search for the given method in the given class.
 202      *
 203      * @param  te        Class to search into.
 204      * @param  method    Method to be searched.
 205      * @return ExecutableElement Method found, null otherwise.
 206      */
 207     public ExecutableElement findMethod(TypeElement te, ExecutableElement method) {
 208         for (Element m : getMethods(te)) {
 209             if (executableMembersEqual(method, (ExecutableElement)m)) {
 210                 return (ExecutableElement)m;
 211             }
 212         }
 213         return null;
 214     }
 215 











 216     /**
 217      * Test whether a class is a subclass of another class.
 218      *
 219      * @param t1 the candidate superclass.
 220      * @param t2 the target
 221      * @return true if t1 is a superclass of t2.
 222      */
 223     public boolean isSubclassOf(TypeElement t1, TypeElement t2) {
 224         return typeUtils.isSubtype(t1.asType(), t2.asType());
 225     }
 226 
 227     /**
 228      * @param e1 the first method to compare.
 229      * @param e2 the second method to compare.
 230      * @return true if member1 overrides/hides or is overriden/hidden by member2.
 231      */
 232 
 233     public boolean executableMembersEqual(ExecutableElement e1, ExecutableElement e2) {
 234         // TODO: investigate if Elements.hides(..) will work here.
 235         if (isStatic(e1) && isStatic(e2)) {




 196                 .collect(Collectors.<Element, List<Element>>toCollection(ArrayList::new));
 197         return excludeList;
 198     }
 199 
 200     /**
 201      * Search for the given method in the given class.
 202      *
 203      * @param  te        Class to search into.
 204      * @param  method    Method to be searched.
 205      * @return ExecutableElement Method found, null otherwise.
 206      */
 207     public ExecutableElement findMethod(TypeElement te, ExecutableElement method) {
 208         for (Element m : getMethods(te)) {
 209             if (executableMembersEqual(method, (ExecutableElement)m)) {
 210                 return (ExecutableElement)m;
 211             }
 212         }
 213         return null;
 214     }
 215 
 216     public ExecutableElement findAccessorFor(VariableElement field, DocTree.Kind kind) {
 217         switch (kind) {
 218             case GETTER:
 219                 return elementUtils.getterFor(field);
 220             case SETTER:
 221                 return elementUtils.setterFor(field);
 222             default:
 223                 throw new IllegalStateException("Cannot get here!");
 224         }
 225     }
 226 
 227     /**
 228      * Test whether a class is a subclass of another class.
 229      *
 230      * @param t1 the candidate superclass.
 231      * @param t2 the target
 232      * @return true if t1 is a superclass of t2.
 233      */
 234     public boolean isSubclassOf(TypeElement t1, TypeElement t2) {
 235         return typeUtils.isSubtype(t1.asType(), t2.asType());
 236     }
 237 
 238     /**
 239      * @param e1 the first method to compare.
 240      * @param e2 the second method to compare.
 241      * @return true if member1 overrides/hides or is overriden/hidden by member2.
 242      */
 243 
 244     public boolean executableMembersEqual(ExecutableElement e1, ExecutableElement e2) {
 245         // TODO: investigate if Elements.hides(..) will work here.
 246         if (isStatic(e1) && isStatic(e2)) {


< prev index next >