33920
|
1 |
/*
|
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
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
|
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
package com.sun.tools.doclets.formats.html;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* Index item for search.
|
|
30 |
*
|
|
31 |
* <p><b>This is NOT part of any supported API.
|
|
32 |
* If you write code that depends on this, you do so at your own risk.
|
|
33 |
* This code and its internal interfaces are subject to change or
|
|
34 |
* deletion without notice.</b>
|
|
35 |
*/
|
|
36 |
public class SearchIndexItem {
|
|
37 |
|
|
38 |
private String label = "";
|
|
39 |
private String url = "";
|
|
40 |
private String category = "";
|
|
41 |
private String containingPackage = "";
|
|
42 |
private String containingClass = "";
|
|
43 |
private String holder = "";
|
|
44 |
private String description = "";
|
|
45 |
|
|
46 |
public void setLabel(String l) {
|
|
47 |
label = l;
|
|
48 |
}
|
|
49 |
|
|
50 |
public String getLabel() {
|
|
51 |
return label;
|
|
52 |
}
|
|
53 |
|
|
54 |
public void setUrl(String u) {
|
|
55 |
url = u;
|
|
56 |
}
|
|
57 |
|
|
58 |
public String getUrl() {
|
|
59 |
return url;
|
|
60 |
}
|
|
61 |
|
|
62 |
public void setContainingPackage(String p) {
|
|
63 |
containingPackage = p;
|
|
64 |
}
|
|
65 |
|
|
66 |
public void setContainingClass(String c) {
|
|
67 |
containingClass = c;
|
|
68 |
}
|
|
69 |
|
|
70 |
public void setCategory(String c) {
|
|
71 |
category = c;
|
|
72 |
}
|
|
73 |
|
|
74 |
public void setHolder(String h) {
|
|
75 |
holder = h;
|
|
76 |
}
|
|
77 |
|
|
78 |
public String getHolder() {
|
|
79 |
return holder;
|
|
80 |
}
|
|
81 |
|
|
82 |
public void setDescription(String d) {
|
|
83 |
description = d;
|
|
84 |
}
|
|
85 |
|
|
86 |
public String getDescription() {
|
|
87 |
return description;
|
|
88 |
}
|
|
89 |
|
|
90 |
public String toString() {
|
|
91 |
StringBuilder item = new StringBuilder("");
|
|
92 |
if (category.equals("Packages")) {
|
|
93 |
item.append("{")
|
|
94 |
.append("\"l\":\"").append(label).append("\"")
|
|
95 |
.append("}");
|
|
96 |
} else if (category.equals("Types")) {
|
|
97 |
item.append("{")
|
|
98 |
.append("\"p\":\"").append(containingPackage).append("\",")
|
|
99 |
.append("\"l\":\"").append(label).append("\"")
|
|
100 |
.append("}");
|
|
101 |
} else if (category.equals("Members")) {
|
|
102 |
item.append("{")
|
|
103 |
.append("\"p\":\"").append(containingPackage).append("\",")
|
|
104 |
.append("\"c\":\"").append(containingClass).append("\",")
|
|
105 |
.append("\"l\":\"").append(label).append("\"");
|
|
106 |
if (!url.equals("")) {
|
|
107 |
item.append(",\"url\":\"").append(url).append("\"");
|
|
108 |
}
|
|
109 |
item.append("}");
|
|
110 |
} else {
|
|
111 |
item.append("{")
|
|
112 |
.append("\"l\":\"").append(label).append("\",")
|
|
113 |
.append("\"h\":\"").append(holder).append("\",");
|
|
114 |
if (!description.equals("")) {
|
|
115 |
item.append("\"d\":\"").append(description).append("\",");
|
|
116 |
}
|
|
117 |
item.append("\"u\":\"").append(url).append("\"")
|
|
118 |
.append("}");
|
|
119 |
}
|
|
120 |
return item.toString();
|
|
121 |
}
|
|
122 |
}
|