Package org.springframework.core.annotation

Examples of org.springframework.core.annotation.AnnotationAttributes


  public static final String KEY_USE_BUILTIN_POSTBACK = "builtinPostback";

  @Override
  public final String[] selectImports(AnnotationMetadata importingClassMetadata) {
    AnnotationAttributes attributes = AnnotationAttributes.fromMap(
      importingClassMetadata.getAnnotationAttributes(EnableBlitlineImageService.class.getName(),
        true));

    Boolean usePostback = (Boolean) attributes.get(KEY_USE_BUILTIN_POSTBACK);

    List<String> classes = new ArrayList<String>(2);
    classes.add(BlitlineConfiguration.class.getName());

    if(usePostback)
View Full Code Here


    // direct access to annotation value:
    assertArrayEquals(new String[] { "foo.xml" }, descriptor.getAnnotation().value());

    // overridden attribute:
    AnnotationAttributes attributes = descriptor.getAnnotationAttributes();

    // NOTE: we would like to be able to override the 'value' attribute; however,
    // Spring currently does not allow overrides for the 'value' attribute.
    // See SPR-11393 for related discussions.
    assertArrayEquals(new String[] { "foo.xml" }, attributes.getStringArray("value"));
  }
View Full Code Here

    // direct access to annotation attributes:
    assertArrayEquals(new String[] { "foo.xml" }, descriptor.getAnnotation().locations());
    assertFalse(descriptor.getAnnotation().inheritLocations());

    // overridden attributes:
    AnnotationAttributes attributes = descriptor.getAnnotationAttributes();
    assertArrayEquals(new String[] { "bar.xml" }, attributes.getStringArray("locations"));
    assertTrue(attributes.getBoolean("inheritLocations"));
  }
View Full Code Here

   * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource)
   */
  @Override
  public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {

    AnnotationAttributes attributes = config.getAttributes();
    if (!attributes.getBoolean("multicoreSupport")) {
      builder.addPropertyReference(BeanDefinition.SOLR_OPERATIONS.getBeanName(),
          attributes.getString("solrTemplateRef"));
    } else {
      builder.addPropertyReference(BeanDefinition.SOLR_SERVER.getBeanName(), attributes.getString("solrServerRef"));
    }
    builder.addPropertyValue("schemaCreationSupport", attributes.getBoolean("schemaCreationSupport"));
    builder.addPropertyReference(BeanDefinition.SOLR_MAPPTING_CONTEXT.getBeanName(), "solrMappingContext");
  }
View Full Code Here

public class BatchConfigurationSelector implements ImportSelector {

  @Override
  public String[] selectImports(AnnotationMetadata importingClassMetadata) {
    Class<?> annotationType = EnableBatchProcessing.class;
    AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(
        annotationType.getName(), false));
    Assert.notNull(attributes, String.format("@%s is not present on importing class '%s' as expected",
        annotationType.getSimpleName(), importingClassMetadata.getClassName()));

    String[] imports;
    if (attributes.containsKey("modular") && attributes.getBoolean("modular")) {
      imports = new String[] { ModularBatchConfiguration.class.getName() };
    }
    else {
      imports = new String[] { SimpleBatchConfiguration.class.getName() };
    }
View Full Code Here

  @Bean
  public abstract PlatformTransactionManager transactionManager() throws Exception;

  @Override
  public void setImportMetadata(AnnotationMetadata importMetadata) {
    AnnotationAttributes enabled = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(
        EnableBatchProcessing.class.getName(), false));
    Assert.notNull(enabled,
        "@EnableBatchProcessing is not present on importing class " + importMetadata.getClassName());
  }
View Full Code Here

    @Override
    public void setImportMetadata(AnnotationMetadata importMetadata) {

        Map<String, Object> enableAttrMap = importMetadata.getAnnotationAttributes(EnableRedisHttpSession.class.getName());
        AnnotationAttributes enableAttrs = AnnotationAttributes.fromMap(enableAttrMap);
        if(enableAttrs == null) {
            // search parent classes
            Class<?> currentClass = ClassUtils.resolveClassName(importMetadata.getClassName(), beanClassLoader);
            for(Class<?> classToInspect = currentClass ;classToInspect != null; classToInspect = classToInspect.getSuperclass()) {
                EnableRedisHttpSession enableWebSecurityAnnotation = AnnotationUtils.findAnnotation(classToInspect, EnableRedisHttpSession.class);
                if(enableWebSecurityAnnotation == null) {
                    continue;
                }
                enableAttrMap = AnnotationUtils
                        .getAnnotationAttributes(enableWebSecurityAnnotation);
                enableAttrs = AnnotationAttributes.fromMap(enableAttrMap);
            }
        }
        maxInactiveIntervalInSeconds = enableAttrs.getNumber("maxInactiveIntervalInSeconds");
    }
View Full Code Here

   * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource)
   */
  @Override
  public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {

    AnnotationAttributes attributes = config.getAttributes();
    builder.addPropertyReference("elasticsearchOperations", attributes.getString("elasticsearchTemplateRef"));
  }
View Full Code Here

   * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource)
   */
  @Override
  public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {

    AnnotationAttributes attributes = config.getAttributes();

    builder.addPropertyReference("mongoOperations", attributes.getString("mongoTemplateRef"));
    builder.addPropertyValue("createIndexesForQueryMethods", attributes.getBoolean("createIndexesForQueryMethods"));
  }
View Full Code Here

      registry.registerBeanDefinition(BEAN_NAME, beanDefinition);
    }
  }

  private String[] getPackagesToScan(AnnotationMetadata metadata) {
    AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata
        .getAnnotationAttributes(EntityScan.class.getName()));
    String[] value = attributes.getStringArray("value");
    String[] basePackages = attributes.getStringArray("basePackages");
    Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");

    if (!ObjectUtils.isEmpty(value)) {
      Assert.state(ObjectUtils.isEmpty(basePackages),
          "@EntityScan basePackages and value attributes are mutually exclusive");
    }
View Full Code Here

TOP

Related Classes of org.springframework.core.annotation.AnnotationAttributes

Copyright © 2018 www.massapicom. 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.