View Javadoc
1   package org.codehaus.mojo.jaxb2.schemageneration.postprocessing.javadoc;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.SortedMap;
23  import java.util.SortedSet;
24  
25  /**
26   * <p>Specification for a Map of SortableLocations correlated to their respective JavaDocData.
27   * To simplify searching and accessing within the JavaDocData, the paths of each SortableLocation
28   * is exposed for searching and listing.</p>
29   *
30   * @author <a href="mailto:lj@jguru.se">Lennart J&ouml;relid</a>, jGuru Europe AB
31   * @since 2.0
32   */
33  public interface SearchableDocumentation {
34  
35      /**
36       * Retrieves all unique SortableLocation paths within this SearchableDocumentation.
37       *
38       * @return all unique SortableLocation paths within this SearchableDocumentation.
39       * The result may be empty, but will never be {@code null}.
40       */
41      SortedSet<String> getPaths();
42  
43      /**
44       * Convenience method to acquire the JavaDocData for a SortableLocation with the supplied path.
45       *
46       * @param path A non-null path for which the harvested JavaDocData should be retrieved.
47       * @return The JavaDocData matching the SortableLocation with the supplied path, or {@code null} if no
48       * SortableLocation with the supplied path was found within this SearchableDocumentation.
49       */
50      JavaDocData getJavaDoc(String path);
51  
52      /**
53       * Convenience method to acquire the SortableLocation corresponding to the given path.
54       *
55       * @param path The path of a SortableLocation, which is retrieved by a call to its {@code toString()} method.
56       * @param <T>  The SortableLocation subtype.
57       * @return the SortableLocation corresponding to the given path, or {@code null} if this SearchableDocumentation
58       * does not contain a SortableLocation with the provided path.
59       */
60      <T extends SortableLocation> T getLocation(String path);
61  
62      /**
63       * The full map relating each SortableLocation subclass to its corresponding JavaDocData.
64       *
65       * @return The full map relating each SortableLocation subclass to its corresponding JavaDocData. Never null.
66       */
67      SortedMap<SortableLocation, JavaDocData> getAll();
68  
69      /**
70       * Convenience method which retrieves a SortedMap relating all SortableLocations of a particular type
71       * to their JavaDocData, respectively.
72       *
73       * @param type The exact type of SortableLocation which should be filtered from the result and returned in the
74       *             form of a SortedMap, along with its respective JavaDocData.
75       * @param <T>  The SortableLocation subtype for which all JavaDocData should be retrieved.
76       * @return a SortedMap relating all SortableLocations of a particular (exact) type (i.e. any subclass types will
77       * <strong>not</strong> be returned) to their JavaDocData, respectively.
78       * May return empty Maps, but never {@code null}.
79       */
80      <T extends SortableLocation> SortedMap<T, JavaDocData> getAll(Class<T> type);
81  }