org.glassfish.jersey.server.model
Class Parameter

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

public class Parameter
extends Object
implements AnnotatedElement

Method parameter model.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static class Parameter.Source
          Parameter injection sources type.
 
Method Summary
static Parameter create(Class concreteClass, Class declaringClass, boolean keepEncoded, Class<?> rawType, Type type, Annotation[] annotations)
          Create a parameter model.
static List<Parameter> create(Class concreteClass, Class declaringClass, Constructor<?> ctor, boolean keepEncoded)
          Create a list of parameter models for a given resource method handler injectable constructor.
static List<Parameter> create(Class concreteClass, Class declaringClass, 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.
<T extends Annotation>
T
getAnnotation(Class<T> annotationClass)
           
 Annotation[] getAnnotations()
           
 Annotation[] getDeclaredAnnotations()
           
 String getDefaultValue()
          Get the default parameter value.
 Class<?> getRawType()
          Get raw type information for the parameter.
 Parameter.Source getSource()
          Get the parameter value source type.
 Annotation getSourceAnnotation()
          Get the parameter source annotation.
 String getSourceName()
          Get the parameter source name, i.e.
 Type getType()
          Get generic type information for the parameter.
 boolean hasDefaultValue()
          Check if the parameter has a default value set.
 boolean isAnnotationPresent(Class<? extends 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)
          Create new parameter model by overriding source of the original parameter model.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static Parameter create(Class concreteClass,
                               Class declaringClass,
                               boolean keepEncoded,
                               Class<?> rawType,
                               Type type,
                               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.
rawType - raw Java parameter type.
type - generic Java parameter type.
annotations - parameter annotations.
Returns:
new parameter model.

create

public static List<Parameter> create(Class concreteClass,
                                     Class declaringClass,
                                     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 List<Parameter> create(Class concreteClass,
                                     Class declaringClass,
                                     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)
Create new parameter model by overriding source of the original parameter model.

Parameters:
original - original parameter model.
source - new overriding parameter source.
Returns:
source-overridden copy of the original parameter.

getSourceAnnotation

public Annotation getSourceAnnotation()
Get the parameter source annotation.

Returns:
parameter source annotation.

getSource

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

Returns:
parameter value source type.

getSourceName

public String getSourceName()
Get the parameter source name, i.e. value of the parameter source annotation.

Returns:
parameter 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 String getDefaultValue()
Get the default parameter value.

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

getRawType

public Class<?> getRawType()
Get raw type information for the parameter.

Returns:
raw parameter type information.

getType

public Type getType()
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(Class<? extends Annotation> annotationClass)
Specified by:
isAnnotationPresent in interface AnnotatedElement

getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
Specified by:
getAnnotation in interface AnnotatedElement

getAnnotations

public Annotation[] getAnnotations()
Specified by:
getAnnotations in interface AnnotatedElement

getDeclaredAnnotations

public Annotation[] getDeclaredAnnotations()
Specified by:
getDeclaredAnnotations in interface AnnotatedElement

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.