View Javadoc

1   /*
2    * Copyright 2006-2012 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.maven.util.report.link.strategy;
17  
18  import de.smartics.maven.util.report.link.AbstractLinkConstructorStrategy;
19  import de.smartics.maven.util.report.link.JavaElementRef;
20  import de.smartics.maven.util.report.link.LinkConstructorStrategyConfig;
21  
22  /**
23   * Constructs a link to a document that contains all package, type and member
24   * information.
25   */
26  public class SingleDocumentLinkConstructorStrategy extends
27      AbstractLinkConstructorStrategy
28  {
29    // ********************************* Fields *********************************
30  
31    // --- constants ------------------------------------------------------------
32  
33    // --- members --------------------------------------------------------------
34  
35    // ****************************** Initializer *******************************
36  
37    // ****************************** Constructors ******************************
38  
39    /**
40     * Default constructor.
41     *
42     * @param config the configuration of this strategy instance.
43     */
44    public SingleDocumentLinkConstructorStrategy(
45        final LinkConstructorStrategyConfig config)
46    {
47      super(config);
48    }
49  
50    // ****************************** Inner Classes *****************************
51  
52    // ********************************* Methods ********************************
53  
54    // --- init -----------------------------------------------------------------
55  
56    // --- get&set --------------------------------------------------------------
57  
58    // --- business -------------------------------------------------------------
59  
60    /**
61     * Appends the separator between the base path and the package part.
62     *
63     * @param buffer the buffer to append to.
64     */
65    protected void appendBasePathSeparator(final StringBuilder buffer)
66    {
67      buffer.append('#');
68    }
69  
70    /**
71     * {@inheritDoc}
72     *
73     * @see de.smartics.maven.util.report.link.AbstractLinkConstructorStrategy#addPackagePart(java.lang.StringBuilder,
74     *      java.lang.String)
75     */
76    @Override
77    protected void addPackagePart(final StringBuilder buffer,
78        final String packageName)
79    {
80      buffer.append(packageName).append('.');
81    }
82  
83    /**
84     * Adds the type part of the link.
85     *
86     * @param buffer the buffer to append to.
87     * @param typeName the name of the package to render.
88     */
89    protected void appendTypePart(final StringBuilder buffer,
90        final String typeName)
91    {
92      buffer.append(typeName);
93    }
94  
95    /**
96     * Adds the member part of the link if the configuration requires the member
97     * part to be rendered.
98     *
99     * @param buffer the buffer to append to.
100    * @param memberName the name of the memberName to render.
101    */
102   protected void appendMemberPart(final StringBuilder buffer,
103       final String memberName)
104   {
105   }
106 
107   protected void constructFilePath(final StringBuilder buffer,
108       final JavaElementRef ref)
109   {
110   }
111 
112   // --- object basics --------------------------------------------------------
113 
114 }