org.glassfish.jersey.server.model
Class Parameter

java.lang.Object
  extended by org.glassfish.jersey.server.model.Parameter
All Implemented Interfaces:
java.lang.reflect.AnnotatedElement

public class Parameter
extends java.lang.Object
implements java.lang.reflect.AnnotatedElement

Abstraction for a method parameter


Nested Class Summary
static class Parameter.Source
           
 
Method Summary
static Parameter create(java.lang.Class concreteClass, java.lang.Class declaringClass, boolean keepEncoded, GenericType<?> paramType, java.lang.annotation.Annotation[] annotations)
          Create a parameter model.
static java.util.List<Parameter> create(java.lang.Class concreteClass, java.lang.Class declaringClass, java.lang.reflect.Constructor<?> ctor, boolean keepEncoded)
          Create a list of parameter models for a given resource method handler injectable constructor.
static java.util.List<Parameter> create(java.lang.Class concreteClass, java.lang.Class declaringClass, java.lang.reflect.Method javaMethod, boolean keepEncoded)
          Create a list of parameter models for a given Java method handling a resource method, sub-resource method or a sub-resource locator.
 java.lang.annotation.Annotation getAnnotation()
          Get the parameter annotations.
<T extends java.lang.annotation.Annotation>
T
getAnnotation(java.lang.Class<T> annotationClass)
           
 java.lang.annotation.Annotation[] getAnnotations()
           
 java.lang.annotation.Annotation[] getDeclaredAnnotations()
           
 java.lang.String getDefaultValue()
          Get the default parameter value.
 GenericType<?> getParameterType()
          Get generic type information for the parameter.
 Parameter.Source getSource()
          Get the parameter value source type.
 java.lang.String getSourceName()
          Get the parameter value source name.
 boolean hasDefaultValue()
          Check if the parameter has a default value set.
 boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
           
 boolean isEncoded()
          If true, the injected parameter value should remain encoded.
 boolean isQualified()
          Check if the parameter is qualified.
static Parameter overrideSource(Parameter original, Parameter.Source source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static Parameter create(java.lang.Class concreteClass,
                               java.lang.Class declaringClass,
                               boolean keepEncoded,
                               GenericType<?> paramType,
                               java.lang.annotation.Annotation[] annotations)
Create a parameter model.

Parameters:
concreteClass - concrete resource method handler implementation class.
declaringClass - declaring class of the method the parameter belongs to.
keepEncoded - set to true to disable automatic decoding of all the constructor parameters. (See Encoded.
paramType - generic parameter type information.
annotations - parameter annotations.
Returns:
new parameter model.

create

public static java.util.List<Parameter> create(java.lang.Class concreteClass,
                                               java.lang.Class declaringClass,
                                               java.lang.reflect.Constructor<?> ctor,
                                               boolean keepEncoded)
Create a list of parameter models for a given resource method handler injectable constructor.

Parameters:
concreteClass - concrete resource method handler implementation class.
declaringClass - TODO ???
ctor - injectable constructor of the resource method handler.
keepEncoded - set to true to disable automatic decoding of all the constructor parameters. (See Encoded.
Returns:
a list of constructor parameter models.

create

public static java.util.List<Parameter> create(java.lang.Class concreteClass,
                                               java.lang.Class declaringClass,
                                               java.lang.reflect.Method javaMethod,
                                               boolean keepEncoded)
Create a list of parameter models for a given Java method handling a resource method, sub-resource method or a sub-resource locator.

Parameters:
concreteClass - concrete resource method handler implementation class.
declaringClass - the class declaring the handling Java method.
javaMethod - Java method handling a resource method, sub-resource method or a sub-resource locator.
keepEncoded - set to true to disable automatic decoding of all the method parameters. (See Encoded.
Returns:
a list of handling method parameter models.

overrideSource

public static Parameter overrideSource(Parameter original,
                                       Parameter.Source source)

getAnnotation

public java.lang.annotation.Annotation getAnnotation()
Get the parameter annotations.

Returns:
parameter annotations.

getSource

public Parameter.Source getSource()
Get the parameter value source type.

Returns:
parameter value source type.

getSourceName

public java.lang.String getSourceName()
Get the parameter value source name.

Returns:
parameter value source name.

isEncoded

public boolean isEncoded()
If true, the injected parameter value should remain encoded.

Returns:
true if the parameter value should remain encoded, false otherwise.

hasDefaultValue

public boolean hasDefaultValue()
Check if the parameter has a default value set.

Returns:
true if the default parameter value has been set, false otherwise.

getDefaultValue

public java.lang.String getDefaultValue()
Get the default parameter value.

Returns:
default parameter value or null if no default value has been set for the parameter.

getParameterType

public GenericType<?> getParameterType()
Get generic type information for the parameter.

Returns:
generic parameter type information.

isQualified

public boolean isQualified()
Check if the parameter is qualified.

Returns:
true if the parameter is qualified, false otherwise.

isAnnotationPresent

public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Specified by:
isAnnotationPresent in interface java.lang.reflect.AnnotatedElement

getAnnotation

public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass)
Specified by:
getAnnotation in interface java.lang.reflect.AnnotatedElement

getAnnotations

public java.lang.annotation.Annotation[] getAnnotations()
Specified by:
getAnnotations in interface java.lang.reflect.AnnotatedElement

getDeclaredAnnotations

public java.lang.annotation.Annotation[] getDeclaredAnnotations()
Specified by:
getDeclaredAnnotations in interface java.lang.reflect.AnnotatedElement


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.