Examples of AnnotationTypeFilter


Examples of org.springframework.core.type.filter.AnnotationTypeFilter

            throws BeansException {
        if (annotationPackage == null || annotationPackage.length() == 0) {
            return;
        }
        ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner((DefaultListableBeanFactory) beanFactory);
        scanner.addIncludeFilter(new AnnotationTypeFilter(Service.class));
        String[] pkgs = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage);
        for (String pkg : pkgs) {
            scanner.scan(pkg);
        }
    }
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

      }
    }

    @Override
    protected void registerDefaultFilters() {
      addIncludeFilter(new AnnotationTypeFilter(AutoDAO.class, false));
    }
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

import org.springframework.core.type.filter.AnnotationTypeFilter;

public class AnnotationEntityDetector extends AbstractEntityDetector {

  public AnnotationEntityDetector() {
    super(new AnnotationTypeFilter(javax.persistence.Entity.class));
  }
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

    EntityManager em;

    @Override
    public void cleanupStaleData() throws Exception {
        ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
        scanner.addIncludeFilter(new AnnotationTypeFilter(Entity.class));

        Set<BeanDefinition> components = scanner.findCandidateComponents("org.fluxtream");
        for (BeanDefinition component : components) {
            Class cls = Class.forName(component.getBeanClassName());
            final String entityName = JPAUtils.getEntityName(cls);
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

   * @throws Exception
   */
  private Class<?>[] getXmlRootElementClasses() throws Exception {
    ClassPathScanningCandidateComponentProvider scanner =
      new ClassPathScanningCandidateComponentProvider(false);
    scanner.addIncludeFilter(new AnnotationTypeFilter(XmlRootElement.class));
   
    List<Class<?>> classes = new ArrayList<Class<?>>();
    for (String basePackage : basePackages) {
      Set<BeanDefinition> definitions = scanner.findCandidateComponents(basePackage);
      for (BeanDefinition definition : definitions) {
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

   * @see org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor#postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo)
   */
  public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui) {

    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
    provider.addIncludeFilter(new AnnotationTypeFilter(Entity.class));
    provider.addIncludeFilter(new AnnotationTypeFilter(MappedSuperclass.class));

    for (BeanDefinition definition : provider.findCandidateComponents(basePackage)) {

      LOG.debug("Registering classpath-scanned entity %s in persistence unit info!", definition.getBeanClassName());
      pui.addManagedClassName(definition.getBeanClassName());
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

  private String cachedDefinitions;

  @PostConstruct
  public void findEntityClasses() {
    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
    provider.addIncludeFilter(new AnnotationTypeFilter(Entity.class));
    Set<BeanDefinition> components = provider.findCandidateComponents(modelsPackage);
    Map<String, Class<?>> result = new HashMap<String, Class<?>>();
    for (BeanDefinition component : components)
    {
      try {
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

   * JSR-330's {@link javax.inject.Named} annotations, if available.
   *
   */
  @SuppressWarnings("unchecked")
  protected void registerDefaultFilters() {
    this.includeFilters.add(new AnnotationTypeFilter(Component.class));
    ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader();
    try {
      this.includeFilters.add(new AnnotationTypeFilter(
          ((Class<? extends Annotation>) ClassUtils.forName("javax.annotation.ManagedBean", cl)), false));
      logger.debug("JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning");
    }
    catch (ClassNotFoundException ex) {
      // JSR-250 1.1 API (as included in Java EE 6) not available - simply skip.
    }
    try {
      this.includeFilters.add(new AnnotationTypeFilter(
          ((Class<? extends Annotation>) ClassUtils.forName("javax.inject.Named", cl)), false));
      logger.debug("JSR-330 'javax.inject.Named' annotation found and supported for component scanning");
    }
    catch (ClassNotFoundException ex) {
      // JSR-330 API not available - simply skip.
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

    String filterType = element.getAttribute(FILTER_TYPE_ATTRIBUTE);
    String expression = element.getAttribute(FILTER_EXPRESSION_ATTRIBUTE);
    expression = parserContext.getReaderContext().getEnvironment().resolvePlaceholders(expression);
    try {
      if ("annotation".equals(filterType)) {
        return new AnnotationTypeFilter((Class<Annotation>) classLoader.loadClass(expression));
      }
      else if ("assignable".equals(filterType)) {
        return new AssignableTypeFilter(classLoader.loadClass(expression));
      }
      else if ("aspectj".equals(filterType)) {
View Full Code Here

Examples of org.springframework.core.type.filter.AnnotationTypeFilter

        case ANNOTATION:
          Assert.isAssignable(Annotation.class, filterClass,
              "An error occured while processing a @ComponentScan ANNOTATION type filter: ");
          @SuppressWarnings("unchecked")
          Class<Annotation> annotationType = (Class<Annotation>) filterClass;
          typeFilters.add(new AnnotationTypeFilter(annotationType));
          break;
        case ASSIGNABLE_TYPE:
          typeFilters.add(new AssignableTypeFilter(filterClass));
          break;
        case CUSTOM:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.