| 1 |
/* |
| 2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| 3 |
* |
| 4 |
* Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved. |
| 5 |
* |
| 6 |
* The contents of this file are subject to the terms of either the GNU |
| 7 |
* General Public License Version 2 only ("GPL") or the Common Development |
| 8 |
* and Distribution License("CDDL") (collectively, the "License"). You |
| 9 |
* may not use this file except in compliance with the License. You can |
| 10 |
* obtain a copy of the License at |
| 11 |
* http://glassfish.java.net/public/CDDL+GPL_1_1.html |
| 12 |
* or packager/legal/LICENSE.txt. See the License for the specific |
| 13 |
* language governing permissions and limitations under the License. |
| 14 |
* |
| 15 |
* When distributing the software, include this License Header Notice in each |
| 16 |
* file and include the License file at packager/legal/LICENSE.txt. |
| 17 |
* |
| 18 |
* GPL Classpath Exception: |
| 19 |
* Oracle designates this particular file as subject to the "Classpath" |
| 20 |
* exception as provided by Oracle in the GPL Version 2 section of the License |
| 21 |
* file that accompanied this code. |
| 22 |
* |
| 23 |
* Modifications: |
| 24 |
* If applicable, add the following below the License Header, with the fields |
| 25 |
* enclosed by brackets [] replaced by your own identifying information: |
| 26 |
* "Portions Copyright [year] [name of copyright owner]" |
| 27 |
* |
| 28 |
* Contributor(s): |
| 29 |
* If you wish your version of this file to be governed by only the CDDL or |
| 30 |
* only the GPL Version 2, indicate your decision by adding "[Contributor] |
| 31 |
* elects to include this software in this distribution under the [CDDL or GPL |
| 32 |
* Version 2] license." If you don't indicate a single choice of license, a |
| 33 |
* recipient has the option to distribute your version of this file under |
| 34 |
* either the CDDL, the GPL Version 2 or to extend the choice of license to |
| 35 |
* its licensees as provided above. However, if you add GPL Version 2 code |
| 36 |
* and therefore, elected the GPL Version 2 license, then the option applies |
| 37 |
* only if the new code is made subject to such option by the copyright |
| 38 |
* holder. |
| 39 |
*/ |
| 40 |
package com.sun.jersey.wadl.resourcedoc; |
| 41 |
|
| 42 |
import com.sun.javadoc.ClassDoc; |
| 43 |
import com.sun.javadoc.MethodDoc; |
| 44 |
import com.sun.javadoc.ParamTag; |
| 45 |
import com.sun.javadoc.Parameter; |
| 46 |
import com.sun.jersey.server.wadl.WadlGenerator; |
| 47 |
import com.sun.jersey.server.wadl.generators.resourcedoc.model.ClassDocType; |
| 48 |
import com.sun.jersey.server.wadl.generators.resourcedoc.model.MethodDocType; |
| 49 |
import com.sun.jersey.server.wadl.generators.resourcedoc.model.ParamDocType; |
| 50 |
|
| 51 |
/** |
| 52 |
* A doc processor is handed over javadoc elements so that it can turn this into |
| 53 |
* resource doc elements, even self defined.<br> |
| 54 |
* Created on: Jul 5, 2008<br> |
| 55 |
* |
| 56 |
* @author <a href="mailto:[email protected]">Martin Grotzke</a> |
| 57 |
* @version $Id$ |
| 58 |
*/ |
| 59 |
public interface DocProcessor { |
| 60 |
|
| 61 |
/** |
| 62 |
* Specify jaxb classes of instances that you add to the resourcedoc model. |
| 63 |
* These classes are added to the list of classes when creating the jaxb context |
| 64 |
* with <code>JAXBContext.newInstance( clazzes );</code>. |
| 65 |
* @return a list of classes or <code>null</code> |
| 66 |
*/ |
| 67 |
Class<?>[] getRequiredJaxbContextClasses(); |
| 68 |
|
| 69 |
/** |
| 70 |
* specify which of your elements you want to be handled as CDATA. |
| 71 |
* The use of the '^' between the namespaceURI and the localname |
| 72 |
* seems to be an implementation detail of the xerces code. |
| 73 |
* When processing xml that doesn't use namespaces, simply omit the |
| 74 |
* namespace prefix as shown in the third CDataElement below. |
| 75 |
* |
| 76 |
* @return an Array of element descriptors or <code>null</code> |
| 77 |
* |
| 78 |
*/ |
| 79 |
String[] getCDataElements(); |
| 80 |
|
| 81 |
/** |
| 82 |
* Use this method to extend the provided {@link ClassDocType} with the information from |
| 83 |
* the given {@link ClassDoc}. |
| 84 |
* @param classDoc the class javadoc |
| 85 |
* @param classDocType the {@link ClassDocType} to extend. This will later be processed by the {@link WadlGenerator}s. |
| 86 |
*/ |
| 87 |
void processClassDoc( ClassDoc classDoc, ClassDocType classDocType ); |
| 88 |
|
| 89 |
/** |
| 90 |
* Process the provided methodDoc and add your custom information to the methodDocType.<br/> |
| 91 |
* Use e.g. {@link MethodDocType#getAny()} to store custom elements. |
| 92 |
* @param methodDoc the {@link MethodDoc} representing the docs of your method. |
| 93 |
* @param methodDocType the related {@link MethodDocType} that will later be processed by the {@link WadlGenerator}s. |
| 94 |
*/ |
| 95 |
void processMethodDoc( MethodDoc methodDoc, MethodDocType methodDocType ); |
| 96 |
|
| 97 |
/** |
| 98 |
* Use this method to extend the provided {@link ParamDocType} with the information from the |
| 99 |
* given {@link ParamTag} and {@link Parameter}. |
| 100 |
* @param paramTag the parameter javadoc |
| 101 |
* @param parameter the parameter (that is documented or not) |
| 102 |
* @param paramDocType the {@link ParamDocType} to extend. This will later be processed by the {@link WadlGenerator}s. |
| 103 |
*/ |
| 104 |
void processParamTag( ParamTag paramTag, Parameter parameter, ParamDocType paramDocType ); |
| 105 |
|
| 106 |
} |