org.apache.cxf.jaxrs.utils.ResourceUtils.findPreDestroyMethod()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(102)

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

ResourceUtils.findPreDestroyMethod介绍

暂无

代码示例

代码示例来源:origin: apache/cxf

public static Method findPreDestroyMethod(Class<?> c) {
  return findPreDestroyMethod(c, null);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public static Method findPreDestroyMethod(Class<?> c) {
  return findPreDestroyMethod(c, null);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public static Method findPreDestroyMethod(Class<?> c, String name) {
  if (Object.class == c || null == c) {
    return null;
  }
  for (Method m : c.getDeclaredMethods()) {
    if (name != null) {
      if (m.getName().equals(name)) {
        return m;
      }
    } else if (m.getAnnotation(PreDestroy.class) != null) {
      return m;
    }
  }
  Method m = findPreDestroyMethod(c.getSuperclass(), name);
  if (m != null) {
    return m;
  }
  for (Class<?> i : c.getInterfaces()) {
    m = findPreDestroyMethod(i, name);
    if (m != null) {
      return m;
    }
  }
  return null;
}

代码示例来源:origin: apache/cxf

public PerRequestResourceProvider(Class<?> clazz) {
  c = ResourceUtils.findResourceConstructor(clazz, true);
  if (c == null) {
    throw new RuntimeException("Resource class " + clazz
                  + " has no valid constructor");
  }
  params = c.getParameterTypes();
  anns = c.getParameterAnnotations();
  genericTypes = c.getGenericParameterTypes();
  postConstructMethod = ResourceUtils.findPostConstructMethod(clazz);
  preDestroyMethod = ResourceUtils.findPreDestroyMethod(clazz);
}

代码示例来源:origin: apache/cxf

public static Method findPreDestroyMethod(Class<?> c, String name) {
  if (Object.class == c || null == c) {
    return null;
  }
  for (Method m : getDeclaredMethods(c)) {
    if (name != null) {
      if (m.getName().equals(name)) {
        return m;
      }
    } else if (m.getAnnotation(PreDestroy.class) != null) {
      return m;
    }
  }
  Method m = findPreDestroyMethod(c.getSuperclass(), name);
  if (m != null) {
    return m;
  }
  for (Class<?> i : c.getInterfaces()) {
    m = findPreDestroyMethod(i, name);
    if (m != null) {
      return m;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public PerRequestResourceProvider(Class<?> clazz) {
  c = ResourceUtils.findResourceConstructor(clazz, true);
  if (c == null) {
    throw new RuntimeException("Resource class " + clazz
                  + " has no valid constructor");
  }
  postConstructMethod = ResourceUtils.findPostConstructMethod(clazz);
  preDestroyMethod = ResourceUtils.findPreDestroyMethod(clazz);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

private void init() {
  Class<?> type = ClassHelper.getRealClassFromClass(ac.getType(beanId));
  if (Proxy.isProxyClass(type)) {
    type = ClassHelper.getRealClass(ac.getBean(beanId));
  }
  c = ResourceUtils.findResourceConstructor(type, !isSingleton());
  if (c == null) {
    throw new RuntimeException("Resource class " + type
                  + " has no valid constructor");
  }
  postConstructMethod = ResourceUtils.findPostConstructMethod(type, postConstructMethodName);
  preDestroyMethod = ResourceUtils.findPreDestroyMethod(type, preDestroyMethodName);
  isSingleton = ac.isSingleton(beanId);
  if (!isSingleton) {
    isPrototype = ac.isPrototype(beanId);
  }
}

代码示例来源:origin: apache/cxf

private void init() {
  type = ClassHelper.getRealClassFromClass(ac.getType(beanId));
  if (Proxy.isProxyClass(type)) {
    type = ClassHelper.getRealClass(ac.getBean(beanId));
  }
  isSingleton = ac.isSingleton(beanId);
  postConstructMethod = ResourceUtils.findPostConstructMethod(type, postConstructMethodName);
  preDestroyMethod = ResourceUtils.findPreDestroyMethod(type, preDestroyMethodName);
  if (isSingleton()) {
    try {
      singletonInstance = ac.getBean(beanId);
    } catch (BeansException ex) {
      // ignore for now, try resolving resource constructor later
    }
    if (singletonInstance != null) {
      return;
    }
  } else {
    isPrototype = ac.isPrototype(beanId);
  }
  c = ResourceUtils.findResourceConstructor(type, !isSingleton());
  if (c == null) {
    throw new RuntimeException("Resource class " + type
                  + " has no valid constructor");
  }
}

代码示例来源:origin: apache/cxf

private void init() {
  Class<?> type = ClassHelper.getRealClassFromClass(blueprintContainer.getComponentInstance(beanId)
                           .getClass());
  if (Proxy.isProxyClass(type)) {
    type = ClassHelper.getRealClass(blueprintContainer.getComponentInstance(beanId));
  }
  c = ResourceUtils.findResourceConstructor(type, !isSingleton());
  if (c == null) {
    throw new RuntimeException("Resource class " + type + " has no valid constructor");
  }
  postConstructMethod = ResourceUtils.findPostConstructMethod(type);
  preDestroyMethod = ResourceUtils.findPreDestroyMethod(type);
  Object component = blueprintContainer.getComponentMetadata(beanId);
  if (component instanceof BeanMetadata) {
    BeanMetadata local = (BeanMetadata) component;
    isSingleton = BeanMetadata.SCOPE_SINGLETON.equals(local.getScope())
      || (local.getScope() == null && local.getId() != null);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

private void init() {
  Class<?> type = ClassHelper.getRealClassFromClass(blueprintContainer.getComponentInstance(beanId)
                           .getClass());
  if (Proxy.isProxyClass(type)) {
    type = ClassHelper.getRealClass(blueprintContainer.getComponentInstance(beanId));
  }
  c = ResourceUtils.findResourceConstructor(type, !isSingleton());
  if (c == null) {
    throw new RuntimeException("Resource class " + type + " has no valid constructor");
  }
  postConstructMethod = ResourceUtils.findPostConstructMethod(type);
  preDestroyMethod = ResourceUtils.findPreDestroyMethod(type);
  Object component = blueprintContainer.getComponentMetadata(beanId);
  if (component instanceof BeanMetadata) {
    BeanMetadata local = (BeanMetadata) component;
    isSingleton = BeanMetadata.SCOPE_SINGLETON.equals(local.getScope())  
      || (local.getScope() == null && local.getId() != null);
  }
}

代码示例来源:origin: org.apache.openejb/openejb-cxf-rs

preDestroyMethod = ResourceUtils.findPreDestroyMethod(clazz);

相关文章

微信公众号

最新文章

更多