langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
48 * @author Bhavesh Patel (Modified) |
48 * @author Bhavesh Patel (Modified) |
49 */ |
49 */ |
50 public abstract class AbstractMemberWriter { |
50 public abstract class AbstractMemberWriter { |
51 |
51 |
52 protected final ConfigurationImpl configuration; |
52 protected final ConfigurationImpl configuration; |
|
53 protected final Utils utils; |
53 protected final SubWriterHolderWriter writer; |
54 protected final SubWriterHolderWriter writer; |
54 protected final ClassDoc classdoc; |
55 protected final ClassDoc classdoc; |
55 protected Map<String,Integer> typeMap = new LinkedHashMap<>(); |
56 protected Map<String,Integer> typeMap = new LinkedHashMap<>(); |
56 protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class); |
57 protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class); |
57 private int methodTypesOr = 0; |
58 private int methodTypesOr = 0; |
62 public AbstractMemberWriter(SubWriterHolderWriter writer, ClassDoc classdoc) { |
63 public AbstractMemberWriter(SubWriterHolderWriter writer, ClassDoc classdoc) { |
63 this.configuration = writer.configuration; |
64 this.configuration = writer.configuration; |
64 this.writer = writer; |
65 this.writer = writer; |
65 this.nodepr = configuration.nodeprecated; |
66 this.nodepr = configuration.nodeprecated; |
66 this.classdoc = classdoc; |
67 this.classdoc = classdoc; |
|
68 this.utils = writer.configuration.utils; |
67 } |
69 } |
68 |
70 |
69 public AbstractMemberWriter(SubWriterHolderWriter writer) { |
71 public AbstractMemberWriter(SubWriterHolderWriter writer) { |
70 this(writer, null); |
72 this(writer, null); |
71 } |
73 } |
242 // added for it to appear on the method details section. Once the |
244 // added for it to appear on the method details section. Once the |
243 // default modifier is added to the Modifier list on DocEnv and once |
245 // default modifier is added to the Modifier list on DocEnv and once |
244 // it is updated to use the javax.lang.model.element.Modifier, we |
246 // it is updated to use the javax.lang.model.element.Modifier, we |
245 // will need to remove this. |
247 // will need to remove this. |
246 mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ? |
248 mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ? |
247 Util.replaceText(mod, "public", "default").trim() : |
249 utils.replaceText(mod, "public", "default").trim() : |
248 Util.replaceText(mod, "public", "").trim(); |
250 utils.replaceText(mod, "public", "").trim(); |
249 } |
251 } |
250 if(mod.length() > 0) { |
252 if(mod.length() > 0) { |
251 htmltree.addContent(mod); |
253 htmltree.addContent(mod); |
252 htmltree.addContent(writer.getSpace()); |
254 htmltree.addContent(writer.getSpace()); |
253 } |
255 } |
536 configuration.getDocletSpecificMsg().warning(pos, key, a1, a2); |
538 configuration.getDocletSpecificMsg().warning(pos, key, a1, a2); |
537 } |
539 } |
538 } |
540 } |
539 |
541 |
540 public ProgramElementDoc[] eligibleMembers(ProgramElementDoc[] members) { |
542 public ProgramElementDoc[] eligibleMembers(ProgramElementDoc[] members) { |
541 return nodepr? Util.excludeDeprecatedMembers(members): members; |
543 return nodepr? utils.excludeDeprecatedMembers(members): members; |
542 } |
544 } |
543 |
545 |
544 /** |
546 /** |
545 * Add the member summary for the given class. |
547 * Add the member summary for the given class. |
546 * |
548 * |
571 } else { |
573 } else { |
572 methodType = (((MethodDoc) member).isAbstract()) |
574 methodType = (((MethodDoc) member).isAbstract()) |
573 ? methodType | MethodTypes.ABSTRACT.value() |
575 ? methodType | MethodTypes.ABSTRACT.value() |
574 : methodType | MethodTypes.CONCRETE.value(); |
576 : methodType | MethodTypes.CONCRETE.value(); |
575 } |
577 } |
576 if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) { |
578 if (utils.isDeprecated(member) || utils.isDeprecated(classdoc)) { |
577 methodType = methodType | MethodTypes.DEPRECATED.value(); |
579 methodType = methodType | MethodTypes.DEPRECATED.value(); |
578 } |
580 } |
579 methodTypesOr = methodTypesOr | methodType; |
581 methodTypesOr = methodTypesOr | methodType; |
580 String tableId = "i" + counter; |
582 String tableId = "i" + counter; |
581 typeMap.put(tableId, methodType); |
583 typeMap.put(tableId, methodType); |