| 1 |
package org.jboss.resteasy.spi.metadata; |
| 2 |
|
| 3 |
import org.jboss.resteasy.util.Types; |
| 4 |
|
| 5 |
import java.lang.annotation.Annotation; |
| 6 |
import java.lang.reflect.AccessibleObject; |
| 7 |
import java.lang.reflect.Type; |
| 8 |
import java.lang.reflect.TypeVariable; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
abstract public class Parameter |
| 15 |
{ |
| 16 |
public static enum ParamType |
| 17 |
{ |
| 18 |
BEAN_PARAM, |
| 19 |
CONTEXT, |
| 20 |
COOKIE_PARAM, |
| 21 |
FORM_PARAM, |
| 22 |
HEADER_PARAM, |
| 23 |
MATRIX_PARAM, |
| 24 |
MESSAGE_BODY, |
| 25 |
PATH_PARAM, |
| 26 |
QUERY_PARAM, |
| 27 |
SUSPENDED, |
| 28 |
UNKNOWN, |
| 29 |
|
| 30 |
FORM, |
| 31 |
QUERY, |
| 32 |
SUSPEND |
| 33 |
} |
| 34 |
|
| 35 |
protected ResourceClass resourceClass; |
| 36 |
protected Class<?> type; |
| 37 |
protected Type genericType; |
| 38 |
protected ParamType paramType = ParamType.UNKNOWN; |
| 39 |
protected String paramName; |
| 40 |
protected boolean encoded; |
| 41 |
protected String defaultValue; |
| 42 |
protected long suspendTimeout; |
| 43 |
|
| 44 |
protected Parameter(ResourceClass resourceClass, Class<?> type, Type genericType) |
| 45 |
{ |
| 46 |
this.resourceClass = resourceClass; |
| 47 |
this.genericType = Types.resolveTypeVariables(resourceClass.getClazz(), genericType); |
| 48 |
this.type = Types.getRawType(this.genericType); |
| 49 |
} |
| 50 |
|
| 51 |
public ResourceClass getResourceClass() |
| 52 |
{ |
| 53 |
return resourceClass; |
| 54 |
} |
| 55 |
|
| 56 |
public Class<?> getType() |
| 57 |
{ |
| 58 |
return type; |
| 59 |
} |
| 60 |
|
| 61 |
public Type getGenericType() |
| 62 |
{ |
| 63 |
return genericType; |
| 64 |
} |
| 65 |
|
| 66 |
public ParamType getParamType() |
| 67 |
{ |
| 68 |
return paramType; |
| 69 |
} |
| 70 |
|
| 71 |
public String getParamName() |
| 72 |
{ |
| 73 |
return paramName; |
| 74 |
} |
| 75 |
|
| 76 |
public boolean isEncoded() |
| 77 |
{ |
| 78 |
return encoded; |
| 79 |
} |
| 80 |
|
| 81 |
public String getDefaultValue() |
| 82 |
{ |
| 83 |
return defaultValue; |
| 84 |
} |
| 85 |
|
| 86 |
public long getSuspendTimeout() |
| 87 |
{ |
| 88 |
return suspendTimeout; |
| 89 |
} |
| 90 |
|
| 91 |
public abstract AccessibleObject getAccessibleObject(); |
| 92 |
public abstract Annotation[] getAnnotations(); |
| 93 |
} |