Example usage for org.springframework.core.type StandardAnnotationMetadata StandardAnnotationMetadata

List of usage examples for org.springframework.core.type StandardAnnotationMetadata StandardAnnotationMetadata

Introduction

In this page you can find the example usage for org.springframework.core.type StandardAnnotationMetadata StandardAnnotationMetadata.

Prototype

@Deprecated
public StandardAnnotationMetadata(Class<?> introspectedClass) 

Source Link

Document

Create a new StandardAnnotationMetadata wrapper for the given Class.

Usage

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringScopeMetadadaResolverIT.java

public void testViewScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(ViewScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);
    AnnotationScopeMetadataResolver annotationScopeMetadataResolver = new JsfCdiToSpringScopeMetadataResolver();

    ScopeMetadata scopeMetadata = annotationScopeMetadataResolver.resolveScopeMetadata(beanDefinition);

    assertThat(scopeMetadata.getScopeName()).isEqualTo(JsfCdiToSpring.VIEW);
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringBeanNameGeneratorIT.java

public void testViewScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(ViewScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);

    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();

    AnnotationBeanNameGenerator annotationBeanNameGeneratorannotationScopeMetadataResolver = new JsfCdiToSpringBeanNameGenerator();

    annotationBeanNameGeneratorannotationScopeMetadataResolver.generateBeanName(beanDefinition, registry);

    assertThat(beanDefinition.getScope()).isEqualTo(JsfCdiToSpring.VIEW);
}

From source file:au.com.permeance.liferay.spring.SimpleMetadataReader.java

/**
 * Creates a new instance, based on the supplied class.
 *
 * @param clazz the class to base this instance on.
 *///from w  w w  . j  a  va 2s .co  m
public SimpleMetadataReader(final Class<?> clazz) {
    standardAnnotationMetadata = new StandardAnnotationMetadata(clazz);
}

From source file:me.yanaga.winter.data.jpa.spring.config.metadata.EnableRepositoriesMetadataTest.java

@Test
public void testEmpty() {
    StandardAnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(EmptyConfiguration.class);
    EnableRepositoriesMetadata metadata = EnableRepositoriesMetadata.of(annotationMetadata);
    assertThat(metadata.getPackagesToScan()).contains("me.yanaga.winter.data.jpa.spring.config.metadata");
}

From source file:org.appcomponents.platform.test.loader.PlatformContextLoader.java

@SuppressWarnings("unchecked")
@Override//www  .  j a  va2 s.c  o m
protected SpringApplication getSpringApplication() {
    StandardAnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(this.config.getTestClass());
    Map<String, Object> annotationAttributes = annotationMetadata
            .getAnnotationAttributes(PlatformTest.class.getName());
    Assert.notNull(annotationAttributes, "No PlatformTest is specified");

    Class<? extends PlatformFactory> platformFactoryClass = (Class<? extends PlatformFactory>) annotationAttributes
            .get("platformFactory");
    PlatformFactory platformFactory = BeanUtils.instantiate(platformFactoryClass);
    return platformFactory.build();
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringScopeMetadadaResolverIT.java

public void testSessionScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(SessionScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);
    AnnotationScopeMetadataResolver annotationScopeMetadataResolver = new JsfCdiToSpringScopeMetadataResolver();

    ScopeMetadata scopeMetadata = annotationScopeMetadataResolver.resolveScopeMetadata(beanDefinition);

    assertThat(scopeMetadata.getScopeName()).isEqualTo(JsfCdiToSpring.SESSION);
}

From source file:me.yanaga.winter.data.jpa.spring.config.metadata.EnableRepositoriesMetadataTest.java

@Test
public void testMetadataBasePackageClasses() {
    StandardAnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(
            BasePackageClassesConfiguration.class);
    EnableRepositoriesMetadata metadata = EnableRepositoriesMetadata.of(annotationMetadata);
    assertThat(metadata.getPackagesToScan()).contains("me.yanaga.winter.data.jpa");
}

From source file:org.joinfaces.annotations.JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java

@Test
public void testViewScopedClass() {
    GenericApplicationContext acx = new GenericApplicationContext();
    AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);

    acx.registerBeanDefinition("viewScopedClass",
            new AnnotatedGenericBeanDefinition(new StandardAnnotationMetadata(ViewScopedClass.class)));
    acx.registerBeanDefinition("scopedBeansConfiguration",
            new RootBeanDefinition(ScopedBeansConfiguration.class));
    acx.addBeanFactoryPostProcessor(new JsfCdiToSpringBeanFactoryPostProcessor());
    acx.refresh();/*  ww w.  j a v a2 s .  c om*/

    assertThat(acx.getBeanDefinition("viewScopedClass").getScope()).isEqualTo(JsfCdiToSpring.VIEW);
    assertThat(acx.getBeanDefinition("viewScopedBean").getScope()).isEqualTo(JsfCdiToSpring.VIEW);
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringBeanNameGeneratorIT.java

public void testSessionScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(SessionScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);

    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();

    AnnotationBeanNameGenerator annotationBeanNameGeneratorannotationScopeMetadataResolver = new JsfCdiToSpringBeanNameGenerator();

    annotationBeanNameGeneratorannotationScopeMetadataResolver.generateBeanName(beanDefinition, registry);

    assertThat(beanDefinition.getScope()).isEqualTo(JsfCdiToSpring.SESSION);
}

From source file:me.yanaga.winter.data.jpa.spring.config.metadata.EnableRepositoriesMetadataTest.java

@Test
public void testMetadataBasePackagesAndClasses() {
    StandardAnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(
            BasePackagesAndClassesConfiguration.class);
    EnableRepositoriesMetadata metadata = EnableRepositoriesMetadata.of(annotationMetadata);
    assertThat(metadata.getPackagesToScan()).contains("me.yanaga", "me.yanaga.winter.data.jpa");
}