org.glassfish.jersey.server.model.AnnotatedMethod.getGenericParameterTypes()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(13.6k)|赞(0)|评价(0)|浏览(67)

本文整理了Java中org.glassfish.jersey.server.model.AnnotatedMethod.getGenericParameterTypes()方法的一些代码示例,展示了AnnotatedMethod.getGenericParameterTypes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotatedMethod.getGenericParameterTypes()方法的具体详情如下:
包路径:org.glassfish.jersey.server.model.AnnotatedMethod
类名称:AnnotatedMethod
方法名:getGenericParameterTypes

AnnotatedMethod.getGenericParameterTypes介绍

[英]Get generic method parameter types. See also Method#getGenericParameterTypes().
[中]获取泛型方法参数类型。另请参见方法#getGenericParameterTypes()。

代码示例

代码示例来源:origin: dropwizard/dropwizard

final Annotation[][] parameterAnnotations = am.getParameterAnnotations();
final Class<?>[] parameterTypes = am.getParameterTypes();
final Type[] parameterGenericTypes = am.getGenericParameterTypes();

代码示例来源:origin: jersey/jersey

/**
 * Create a list of parameter models for a given Java method handling a resource
 * method, sub-resource method or a sub-resource locator.
 *
 * @param concreteClass  concrete resource method handler implementation class.
 * @param declaringClass the class declaring the handling Java method.
 * @param javaMethod     Java method handling a resource method, sub-resource
 *                       method or a sub-resource locator.
 * @param keepEncoded    set to {@code true} to disable automatic decoding
 *                       of all the method parameters. (See {@link Encoded}.
 * @return a list of handling method parameter models.
 */
public static List<Parameter> create(
    Class concreteClass,
    Class declaringClass,
    Method javaMethod,
    boolean keepEncoded) {
  AnnotatedMethod method = new AnnotatedMethod(javaMethod);
  return create(
      concreteClass, declaringClass,
      ((null != method.getAnnotation(Encoded.class)) || keepEncoded),
      method.getParameterTypes(),
      method.getGenericParameterTypes(),
      method.getParameterAnnotations());
}

代码示例来源:origin: jersey/jersey

/**
 * Create a list of parameter models for a given Java method handling a resource
 * method, sub-resource method or a sub-resource locator.
 *
 * @param concreteClass  concrete resource method handler implementation class.
 * @param declaringClass the class declaring the handling Java method.
 * @param javaMethod     Java method handling a resource method, sub-resource
 *                       method or a sub-resource locator.
 * @param keepEncoded    set to {@code true} to disable automatic decoding
 *                       of all the method parameters. (See {@link Encoded}.
 * @return a list of handling method parameter models.
 */
public static List<Parameter> create(
    Class concreteClass,
    Class declaringClass,
    Method javaMethod,
    boolean keepEncoded) {
  AnnotatedMethod method = new AnnotatedMethod(javaMethod);
  return create(
      concreteClass, declaringClass,
      ((null != method.getAnnotation(Encoded.class)) || keepEncoded),
      method.getParameterTypes(),
      method.getGenericParameterTypes(),
      method.getParameterAnnotations());
}

代码示例来源:origin: jersey/jersey

private void checkResourceClassSetters(final MethodList methodList,
                    final boolean encodedFlag,
                    Collection<Parameter> injectableParameters) {
  for (AnnotatedMethod method : methodList.withoutMetaAnnotation(HttpMethod.class)
      .withoutAnnotation(Path.class)
      .hasNumParams(1)
      .hasReturnType(void.class)
      .nameStartsWith("set")) {
    Parameter p = Parameter.create(
        handlerClass,
        method.getMethod().getDeclaringClass(),
        encodedFlag || method.isAnnotationPresent(Encoded.class),
        method.getParameterTypes()[0],
        method.getGenericParameterTypes()[0],
        method.getAnnotations());
    if (null != p) {
      ResourceMethodValidator.validateParameter(p, method.getMethod(), method.getMethod().toGenericString(), "1",
          InvocableValidator.isSingleton(handlerClass));
      // we do not inject entity parameters into class instance fields and properties.
      if (p.getSource() != Parameter.Source.ENTITY) {
        injectableParameters.add(p);
      }
    }
  }
}

代码示例来源:origin: jersey/jersey

private void checkResourceClassSetters(final MethodList methodList,
                    final boolean encodedFlag,
                    Collection<Parameter> injectableParameters) {
  for (AnnotatedMethod method : methodList.withoutMetaAnnotation(HttpMethod.class)
      .withoutAnnotation(Path.class)
      .hasNumParams(1)
      .hasReturnType(void.class)
      .nameStartsWith("set")) {
    Parameter p = Parameter.create(
        handlerClass,
        method.getMethod().getDeclaringClass(),
        encodedFlag || method.isAnnotationPresent(Encoded.class),
        method.getParameterTypes()[0],
        method.getGenericParameterTypes()[0],
        method.getAnnotations());
    if (null != p) {
      ResourceMethodValidator.validateParameter(p, method.getMethod(), method.getMethod().toGenericString(), "1",
          InvocableValidator.isSingleton(handlerClass));
      // we do not inject entity parameters into class instance fields and properties.
      if (p.getSource() != Parameter.Source.ENTITY) {
        injectableParameters.add(p);
      }
    }
  }
}

代码示例来源:origin: org.glassfish.jersey.core/jersey-server

/**
 * Create a list of parameter models for a given Java method handling a resource
 * method, sub-resource method or a sub-resource locator.
 *
 * @param concreteClass  concrete resource method handler implementation class.
 * @param declaringClass the class declaring the handling Java method.
 * @param javaMethod     Java method handling a resource method, sub-resource
 *                       method or a sub-resource locator.
 * @param keepEncoded    set to {@code true} to disable automatic decoding
 *                       of all the method parameters. (See {@link Encoded}.
 * @return a list of handling method parameter models.
 */
public static List<Parameter> create(
    Class concreteClass,
    Class declaringClass,
    Method javaMethod,
    boolean keepEncoded) {
  AnnotatedMethod method = new AnnotatedMethod(javaMethod);
  return create(
      concreteClass, declaringClass,
      ((null != method.getAnnotation(Encoded.class)) || keepEncoded),
      method.getParameterTypes(),
      method.getGenericParameterTypes(),
      method.getParameterAnnotations());
}

代码示例来源:origin: org.glassfish.jersey.core/jersey-server

private void checkResourceClassSetters(final MethodList methodList,
                    final boolean encodedFlag,
                    Collection<Parameter> injectableParameters) {
  for (AnnotatedMethod method : methodList.withoutMetaAnnotation(HttpMethod.class)
      .withoutAnnotation(Path.class)
      .hasNumParams(1)
      .hasReturnType(void.class)
      .nameStartsWith("set")) {
    Parameter p = Parameter.create(
        handlerClass,
        method.getMethod().getDeclaringClass(),
        encodedFlag || method.isAnnotationPresent(Encoded.class),
        method.getParameterTypes()[0],
        method.getGenericParameterTypes()[0],
        method.getAnnotations());
    if (null != p) {
      ResourceMethodValidator.validateParameter(p, method.getMethod(), method.getMethod().toGenericString(), "1",
          InvocableValidator.isSingleton(handlerClass));
      // we do not inject entity parameters into class instance fields and properties.
      if (p.getSource() != Parameter.Source.ENTITY) {
        injectableParameters.add(p);
      }
    }
  }
}

代码示例来源:origin: io.dropwizard/dropwizard-auth

final Annotation[][] parameterAnnotations = am.getParameterAnnotations();
final Class<?>[] parameterTypes = am.getParameterTypes();
final Type[] parameterGenericTypes = am.getGenericParameterTypes();

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Create a list of parameter models for a given Java method handling a resource
 * method, sub-resource method or a sub-resource locator.
 *
 * @param concreteClass  concrete resource method handler implementation class.
 * @param declaringClass the class declaring the handling Java method.
 * @param javaMethod     Java method handling a resource method, sub-resource
 *                       method or a sub-resource locator.
 * @param keepEncoded    set to {@code true} to disable automatic decoding
 *                       of all the method parameters. (See {@link Encoded}.
 * @return a list of handling method parameter models.
 */
public static List<Parameter> create(
    Class concreteClass,
    Class declaringClass,
    Method javaMethod,
    boolean keepEncoded) {
  AnnotatedMethod method = new AnnotatedMethod(javaMethod);
  return create(
      concreteClass, declaringClass,
      ((null != method.getAnnotation(Encoded.class)) || keepEncoded),
      method.getParameterTypes(),
      method.getGenericParameterTypes(),
      method.getParameterAnnotations());
}

代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri

/**
 * Create a list of parameter models for a given Java method handling a resource
 * method, sub-resource method or a sub-resource locator.
 *
 * @param concreteClass  concrete resource method handler implementation class.
 * @param declaringClass the class declaring the handling Java method.
 * @param javaMethod     Java method handling a resource method, sub-resource
 *                       method or a sub-resource locator.
 * @param keepEncoded    set to {@code true} to disable automatic decoding
 *                       of all the method parameters. (See {@link Encoded}.
 * @return a list of handling method parameter models.
 */
public static List<Parameter> create(
    Class concreteClass,
    Class declaringClass,
    Method javaMethod,
    boolean keepEncoded) {
  AnnotatedMethod method = new AnnotatedMethod(javaMethod);
  return create(
      concreteClass, declaringClass,
      ((null != method.getAnnotation(Encoded.class)) || keepEncoded),
      method.getParameterTypes(),
      method.getGenericParameterTypes(),
      method.getParameterAnnotations());
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Create a list of parameter models for a given Java method handling a resource
 * method, sub-resource method or a sub-resource locator.
 *
 * @param concreteClass  concrete resource method handler implementation class.
 * @param declaringClass the class declaring the handling Java method.
 * @param javaMethod     Java method handling a resource method, sub-resource
 *                       method or a sub-resource locator.
 * @param keepEncoded    set to {@code true} to disable automatic decoding
 *                       of all the method parameters. (See {@link Encoded}.
 * @return a list of handling method parameter models.
 */
public static List<Parameter> create(
    Class concreteClass,
    Class declaringClass,
    Method javaMethod,
    boolean keepEncoded) {
  AnnotatedMethod method = new AnnotatedMethod(javaMethod);
  return create(
      concreteClass, declaringClass,
      ((null != method.getAnnotation(Encoded.class)) || keepEncoded),
      method.getParameterTypes(),
      method.getGenericParameterTypes(),
      method.getParameterAnnotations());
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Create a list of parameter models for a given Java method handling a resource
 * method, sub-resource method or a sub-resource locator.
 *
 * @param concreteClass  concrete resource method handler implementation class.
 * @param declaringClass the class declaring the handling Java method.
 * @param javaMethod     Java method handling a resource method, sub-resource
 *                       method or a sub-resource locator.
 * @param keepEncoded    set to {@code true} to disable automatic decoding
 *                       of all the method parameters. (See {@link Encoded}.
 * @return a list of handling method parameter models.
 */
public static List<Parameter> create(
    Class concreteClass,
    Class declaringClass,
    Method javaMethod,
    boolean keepEncoded) {
  AnnotatedMethod method = new AnnotatedMethod(javaMethod);
  return create(
      concreteClass, declaringClass,
      ((null != method.getAnnotation(Encoded.class)) || keepEncoded),
      method.getParameterTypes(),
      method.getGenericParameterTypes(),
      method.getParameterAnnotations());
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private void checkResourceClassSetters(final MethodList methodList,
                    final boolean encodedFlag,
                    Collection<Parameter> injectableParameters) {
  for (AnnotatedMethod method : methodList.withoutMetaAnnotation(HttpMethod.class)
      .withoutAnnotation(Path.class)
      .hasNumParams(1)
      .hasReturnType(void.class)
      .nameStartsWith("set")) {
    Parameter p = Parameter.create(
        handlerClass,
        method.getMethod().getDeclaringClass(),
        encodedFlag || method.isAnnotationPresent(Encoded.class),
        method.getParameterTypes()[0],
        method.getGenericParameterTypes()[0],
        method.getAnnotations());
    if (null != p) {
      ResourceMethodValidator.validateParameter(p, method.getMethod(), method.getMethod().toGenericString(), "1",
          InvocableValidator.isSingleton(handlerClass));
      // we do not inject entity parameters into class instance fields and properties.
      if (p.getSource() != Parameter.Source.ENTITY) {
        injectableParameters.add(p);
      }
    }
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

private void checkResourceClassSetters(final MethodList methodList,
                    final boolean encodedFlag,
                    Collection<Parameter> injectableParameters) {
  for (AnnotatedMethod method : methodList.withoutMetaAnnotation(HttpMethod.class)
      .withoutAnnotation(Path.class)
      .hasNumParams(1)
      .hasReturnType(void.class)
      .nameStartsWith("set")) {
    Parameter p = Parameter.create(
        handlerClass,
        method.getMethod().getDeclaringClass(),
        encodedFlag || method.isAnnotationPresent(Encoded.class),
        method.getParameterTypes()[0],
        method.getGenericParameterTypes()[0],
        method.getAnnotations());
    if (null != p) {
      ResourceMethodValidator.validateParameter(p, method.getMethod(), method.getMethod().toGenericString(), "1",
          InvocableValidator.isSingleton(handlerClass));
      // we do not inject entity parameters into class instance fields and properties.
      if (p.getSource() != Parameter.Source.ENTITY) {
        injectableParameters.add(p);
      }
    }
  }
}

代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri

private void checkResourceClassSetters(final MethodList methodList,
                    final boolean encodedFlag,
                    Collection<Parameter> injectableParameters) {
  for (AnnotatedMethod method : methodList.withoutMetaAnnotation(HttpMethod.class)
      .withoutAnnotation(Path.class)
      .hasNumParams(1)
      .hasReturnType(void.class)
      .nameStartsWith("set")) {
    Parameter p = Parameter.create(
        handlerClass,
        method.getMethod().getDeclaringClass(),
        encodedFlag || method.isAnnotationPresent(Encoded.class),
        method.getParameterTypes()[0],
        method.getGenericParameterTypes()[0],
        method.getAnnotations());
    if (null != p) {
      ResourceMethodValidator.validateParameter(p, method.getMethod(), method.getMethod().toGenericString(), "1",
          InvocableValidator.isSingleton(handlerClass));
      // we do not inject entity parameters into class instance fields and properties.
      if (p.getSource() != Parameter.Source.ENTITY) {
        injectableParameters.add(p);
      }
    }
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private void checkResourceClassSetters(final MethodList methodList,
                    final boolean encodedFlag,
                    Collection<Parameter> injectableParameters) {
  for (AnnotatedMethod method : methodList.withoutMetaAnnotation(HttpMethod.class)
      .withoutAnnotation(Path.class)
      .hasNumParams(1)
      .hasReturnType(void.class)
      .nameStartsWith("set")) {
    Parameter p = Parameter.create(
        handlerClass,
        method.getMethod().getDeclaringClass(),
        encodedFlag || method.isAnnotationPresent(Encoded.class),
        method.getParameterTypes()[0],
        method.getGenericParameterTypes()[0],
        method.getAnnotations());
    if (null != p) {
      ResourceMethodValidator.validateParameter(p, method.getMethod(), method.getMethod().toGenericString(), "1",
          InvocableValidator.isSingleton(handlerClass));
      // we do not inject entity parameters into class instance fields and properties.
      if (p.getSource() != Parameter.Source.ENTITY) {
        injectableParameters.add(p);
      }
    }
  }
}

相关文章