org.restlet.ext.wadl
Class MethodInfo

java.lang.Object
  extended by org.restlet.ext.wadl.DocumentedInfo
      extended by org.restlet.ext.wadl.MethodInfo

public class MethodInfo
extends DocumentedInfo

Describes the expected requests and responses of a resource method.

Author:
Jerome Louvel

Constructor Summary
MethodInfo()
          Constructor.
MethodInfo(DocumentationInfo documentation)
          Constructor with a single documentation element.
MethodInfo(List<DocumentationInfo> documentations)
          Constructor with a list of documentation elements.
MethodInfo(String documentation)
          Constructor with a single documentation element.
 
Method Summary
 RepresentationInfo addFault(Status status, MediaType mediaType, String documentation)
          Deprecated. Use the ResponseInfo.getRepresentations() method instead.
 ParameterInfo addRequestParameter(String name, boolean required, String type, ParameterStyle style, String documentation)
          Deprecated. Use RequestInfo.getParameters() instead.
 RepresentationInfo addRequestRepresentation(Variant variant)
          Deprecated. Use RequestInfo.getRepresentations() instead.
 ParameterInfo addResponseParameter(String name, boolean required, String type, ParameterStyle style, String documentation)
          Deprecated. Use the ResponseInfo.getParameters() method instead.
 RepresentationInfo addResponseRepresentation(Variant variant)
          Deprecated. Use ResponseInfo.getRepresentations() instead.
static void describeAnnotations(MethodInfo info, ServerResource resource)
          Automatically describe a method by discovering the resource's annotations.
 String getIdentifier()
          Returns the identifier for the method.
 Method getName()
          Returns the name of the method.
 RequestInfo getRequest()
          Returns the input to the method.
 ResponseInfo getResponse()
          Returns the last added response of the method.
 List<ResponseInfo> getResponses()
          Returns the output of the method.
 Reference getTargetRef()
          Returns the reference to a method definition element.
 void setIdentifier(String identifier)
          Sets the identifier for the method.
 void setName(Method name)
          Sets the name of the method.
 void setRequest(RequestInfo request)
          Sets the input to the method.
 void setResponsee(ResponseInfo response)
          Deprecated. Use the getResponses() or setResponses(List) methods instead.
 void setResponses(List<ResponseInfo> responses)
          Sets the output of the method.
 void setTargetRef(Reference targetRef)
          Sets the reference to a method definition element.
 void updateNamespaces(Map<String,String> namespaces)
          Completes the given map of namespaces with the namespaces used in the documentation elements.
 void writeElement(XmlWriter writer)
          Writes the current object as an XML element using the given SAX writer.
 
Methods inherited from class org.restlet.ext.wadl.DocumentedInfo
getDocumentations, resolveNamespaces, setDocumentation, setDocumentation, setDocumentations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInfo

public MethodInfo()
Constructor.


MethodInfo

public MethodInfo(DocumentationInfo documentation)
Constructor with a single documentation element.

Parameters:
documentation - A single documentation element.

MethodInfo

public MethodInfo(List<DocumentationInfo> documentations)
Constructor with a list of documentation elements.

Parameters:
documentations - The list of documentation elements.

MethodInfo

public MethodInfo(String documentation)
Constructor with a single documentation element.

Parameters:
documentation - A single documentation element.
Method Detail

describeAnnotations

public static void describeAnnotations(MethodInfo info,
                                       ServerResource resource)
Automatically describe a method by discovering the resource's annotations.

Parameters:
info - The method description to update.
resource - The server resource to describe.

addFault

@Deprecated
public RepresentationInfo addFault(Status status,
                                              MediaType mediaType,
                                              String documentation)
Deprecated. Use the ResponseInfo.getRepresentations() method instead.

Adds a new fault to the response.

Parameters:
status - The associated status code.
mediaType - The fault representation's media type.
documentation - A single documentation element.
Returns:
The created fault description.

addRequestParameter

@Deprecated
public ParameterInfo addRequestParameter(String name,
                                                    boolean required,
                                                    String type,
                                                    ParameterStyle style,
                                                    String documentation)
Deprecated. Use RequestInfo.getParameters() instead.

Adds a new request parameter.

Parameters:
name - The name of the parameter.
required - True if thes parameter is required.
type - The type of the parameter.
style - The style of the parameter.
documentation - A single documentation element.
Returns:
The created parameter description.

addRequestRepresentation

@Deprecated
public RepresentationInfo addRequestRepresentation(Variant variant)
Deprecated. Use RequestInfo.getRepresentations() instead.

Adds a new request representation based on a given variant.

Parameters:
variant - The variant to describe.
Returns:
The created representation description.

addResponseParameter

@Deprecated
public ParameterInfo addResponseParameter(String name,
                                                     boolean required,
                                                     String type,
                                                     ParameterStyle style,
                                                     String documentation)
Deprecated. Use the ResponseInfo.getParameters() method instead.

Adds a new response parameter.

Parameters:
name - The name of the parameter.
required - True if the parameter is required.
type - The type of the parameter.
style - The style of the parameter.
documentation - A single documentation element.
Returns:
The created parameter description.

addResponseRepresentation

@Deprecated
public RepresentationInfo addResponseRepresentation(Variant variant)
Deprecated. Use ResponseInfo.getRepresentations() instead.

Adds a new response representation based on a given variant.

Parameters:
variant - The variant to describe.
Returns:
The created representation description.

getIdentifier

public String getIdentifier()
Returns the identifier for the method.

Returns:
The identifier for the method.

getName

public Method getName()
Returns the name of the method.

Returns:
The name of the method.

getRequest

public RequestInfo getRequest()
Returns the input to the method.

Returns:
The input to the method.

getResponse

public ResponseInfo getResponse()
Returns the last added response of the method.

Returns:
The last added response of the method.

getResponses

public List<ResponseInfo> getResponses()
Returns the output of the method.

Returns:
The output of the method.

getTargetRef

public Reference getTargetRef()
Returns the reference to a method definition element.

Returns:
The reference to a method definition element.

setIdentifier

public void setIdentifier(String identifier)
Sets the identifier for the method.

Parameters:
identifier - The identifier for the method.

setName

public void setName(Method name)
Sets the name of the method.

Parameters:
name - The name of the method.

setRequest

public void setRequest(RequestInfo request)
Sets the input to the method.

Parameters:
request - The input to the method.

setResponsee

@Deprecated
public void setResponsee(ResponseInfo response)
Deprecated. Use the getResponses() or setResponses(List) methods instead.

Sets the output of the method.

Parameters:
response - The output of the method.

setResponses

public void setResponses(List<ResponseInfo> responses)
Sets the output of the method.

Parameters:
responses - The output of the method.

setTargetRef

public void setTargetRef(Reference targetRef)
Sets the reference to a method definition element.

Parameters:
targetRef - The reference to a method definition element.

updateNamespaces

public void updateNamespaces(Map<String,String> namespaces)
Description copied from class: DocumentedInfo
Completes the given map of namespaces with the namespaces used in the documentation elements. The key is the URI of the namespace and the value, the prefix.

Specified by:
updateNamespaces in class DocumentedInfo
Parameters:
namespaces - The given map of namespaces to complete.

writeElement

public void writeElement(XmlWriter writer)
                  throws SAXException
Writes the current object as an XML element using the given SAX writer.

Parameters:
writer - The SAX writer.
Throws:
SAXException


Copyright © 2005-2011 Noelios Technologies.