當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotationAttributes.getStringArray方法代碼示例

本文整理匯總了Java中org.springframework.core.annotation.AnnotationAttributes.getStringArray方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationAttributes.getStringArray方法的具體用法?Java AnnotationAttributes.getStringArray怎麽用?Java AnnotationAttributes.getStringArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.core.annotation.AnnotationAttributes的用法示例。


在下文中一共展示了AnnotationAttributes.getStringArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerBeanDefinitions

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
  AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata
      .getAnnotationAttributes(EnableApolloConfig.class.getName()));
  String[] namespaces = attributes.getStringArray("value");
  int order = attributes.getNumber("order");
  PropertySourcesProcessor.addNamespaces(Lists.newArrayList(namespaces), order);

  BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesPlaceholderConfigurer.class.getName(),
      PropertySourcesPlaceholderConfigurer.class);

  BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesProcessor.class.getName(),
      PropertySourcesProcessor.class);

  BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, ApolloAnnotationProcessor.class.getName(),
      ApolloAnnotationProcessor.class);
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:18,代碼來源:ApolloConfigRegistrar.java

示例2: registerBeanDefinitions

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
    Boolean enableSpringfox = Profiles.getProfile("springfox");

    if (!enableSpringfox) {
        return;
    }

    AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(EnableSpringFox.class.getName(), false));
    Assert.notNull(attributes, String.format("@%s is not present on importing class '%s' as expected", EnableSpringFox.class.getName(), importingClassMetadata.getClassName()));

    String prefix = attributes.getString(PREFIX_ATTRIBUTE_NAME);

    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SpringFoxPathProvider.class);
    builder.addPropertyValue("prefix", prefix);

    registry.registerBeanDefinition(SpringFoxPathProvider.class.getName(), builder.getBeanDefinition());

    String[] groups = attributes.getStringArray(GROUPS_ATTRIBUTE_NAME);
    for (String group : groups) {
        BeanDefinitionBuilder docket = BeanDefinitionBuilder.genericBeanDefinition(SpringFoxDocket.class);
        docket.addConstructorArgValue(group);

        registry.registerBeanDefinition(group + "Docket", docket.getBeanDefinition());
    }
}
 
開發者ID:lodsve,項目名稱:lodsve-framework,代碼行數:27,代碼來源:SpringFoxRegistrar.java

示例3: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
	AnnotationAttributes attributes = AnnotationAttributes.fromMap(
			metadata.getAnnotationAttributes(ServletComponentScan.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),
				"@ServletComponentScan basePackages and value attributes are"
						+ " mutually exclusive");
	}
	Set<String> packagesToScan = new LinkedHashSet<String>();
	packagesToScan.addAll(Arrays.asList(value));
	packagesToScan.addAll(Arrays.asList(basePackages));
	for (Class<?> basePackageClass : basePackageClasses) {
		packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
	}
	if (packagesToScan.isEmpty()) {
		return Collections
				.singleton(ClassUtils.getPackageName(metadata.getClassName()));
	}
	return packagesToScan;
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:24,代碼來源:ServletComponentScanRegistrar.java

示例4: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
	AnnotationAttributes attributes = AnnotationAttributes.fromMap(
			metadata.getAnnotationAttributes(EntityScan.class.getName()));
	String[] basePackages = attributes.getStringArray("basePackages");
	Class<?>[] basePackageClasses = attributes
			.getClassArray("basePackageClasses");
	Set<String> packagesToScan = new LinkedHashSet<String>();
	packagesToScan.addAll(Arrays.asList(basePackages));
	for (Class<?> basePackageClass : basePackageClasses) {
		packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
	}
	if (packagesToScan.isEmpty()) {
		String packageName = ClassUtils.getPackageName(metadata.getClassName());
		Assert.state(!StringUtils.isEmpty(packageName),
				"@EntityScan cannot be used with the default package");
		return Collections.singleton(packageName);
	}
	return packagesToScan;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:20,代碼來源:EntityScanPackages.java

示例5: getBasePackages

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
public static String[] getBasePackages(AnnotationAttributes attributes, String[] defaultPackages) {
	
	String[] value = attributes.getStringArray("value");
	String[] basePackages = attributes.getStringArray(BASE_PACKAGES);
	Class<?>[] basePackageClasses = attributes.getClassArray(BASE_PACKAGE_CLASSES);

	// Default configuration - return package of annotated class
	if (value.length == 0 && basePackages.length == 0 && basePackageClasses.length == 0) {
		return defaultPackages;
	}

	Set<String> packages = new HashSet<String>();
	packages.addAll(Arrays.asList(value));
	packages.addAll(Arrays.asList(basePackages));

	for (Class<?> typeName : basePackageClasses) {
		packages.add(ClassUtils.getPackageName(typeName));
	}

	return packages.toArray(new String[] {});
}
 
開發者ID:paulcwarren,項目名稱:spring-content,代碼行數:22,代碼來源:StoreUtils.java

示例6: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
    AnnotationAttributes attributes = AnnotationAttributes
            .fromMap(metadata.getAnnotationAttributes(ServletComponentScan.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),
                "@ServletComponentScan basePackages and value attributes are" + " mutually exclusive");
    }
    Set<String> packagesToScan = new LinkedHashSet<String>();
    packagesToScan.addAll(Arrays.asList(value));
    packagesToScan.addAll(Arrays.asList(basePackages));
    for (Class<?> basePackageClass : basePackageClasses) {
        packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
    }
    if (packagesToScan.isEmpty()) {
        return Collections.singleton(ClassUtils.getPackageName(metadata.getClassName()));
    }
    return packagesToScan;
}
 
開發者ID:PebbleTemplates,項目名稱:pebble-spring-boot-starter,代碼行數:22,代碼來源:ServletComponentScanRegistrar.java

示例7: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
	AnnotationAttributes attributes = AnnotationAttributes.fromMap(
			metadata.getAnnotationAttributes(ServletComponentScan.class.getName()));
	String[] basePackages = attributes.getStringArray("basePackages");
	Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
	Set<String> packagesToScan = new LinkedHashSet<String>();
	packagesToScan.addAll(Arrays.asList(basePackages));
	for (Class<?> basePackageClass : basePackageClasses) {
		packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
	}
	if (packagesToScan.isEmpty()) {
		return Collections
				.singleton(ClassUtils.getPackageName(metadata.getClassName()));
	}
	return packagesToScan;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:17,代碼來源:ServletComponentScanRegistrar.java

示例8: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private static Set<String> getPackagesToScan(AnnotationAttributes attributes) {
	String[] basePackages = attributes.getStringArray("basePackages");
	Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
	Set<String> packagesToScan = new LinkedHashSet<>();
	packagesToScan.addAll(Arrays.asList(basePackages));
	for (Class<?> basePackageClass : basePackageClasses) {
		packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
	}
	return packagesToScan;
}
 
開發者ID:holon-platform,項目名稱:holon-datastore-jpa,代碼行數:11,代碼來源:JpaEntityScanPackages.java

示例9: parsePatterns

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private Set<Pattern> parsePatterns(AnnotationMetadata annotation, String attributeName) {
	Set<Pattern> result = new HashSet<Pattern>();
	AnnotationAttributes attributes = new AnnotationAttributes(
			annotation.getAnnotationAttributes(GuiceModule.class.getName()));
	String[] filters = attributes.getStringArray(attributeName);

	for (String filter : filters) {
		result.add(Pattern.compile(filter));
	}

	return result;
}
 
開發者ID:beingsagir,項目名稱:play-java-spring-data-jpa,代碼行數:13,代碼來源:GuiceModuleRegistrar.java

示例10: getMatchOutcome

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(
			metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName()));
	String[] locations = annotationAttributes.getStringArray("value");
	try {
		return getMatchOutcome(locations);
	}
	catch (NoClassDefFoundError ex) {
		return ConditionOutcome.noMatch("JNDI class not found");
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:OnJndiCondition.java

示例11: getPatterns

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private String[] getPatterns(AnnotationAttributes filterAttributes) {

		try {
			return filterAttributes.getStringArray("pattern");
		} catch (IllegalArgumentException o_O) {
			return new String[0];
		}
	}
 
開發者ID:beingsagir,項目名稱:play-java-spring-data-jpa,代碼行數:9,代碼來源:GuiceModuleRegistrar.java

示例12: registerBeanDefinitions

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry beanDefinitionRegistry) {
    AnnotationAttributes attributes = AnnotationAttributes.fromMap(annotationMetadata.getAnnotationAttributes(EnableRedis.class.getName(), false));
    String[] names = attributes.getStringArray(DATASOURCE_NAME_ATTRIBUTE_NAME);

    for (String name : names) {
        if (beanDefinitionRegistry.containsBeanDefinition(name)) {
            continue;
        }

        beanDefinitionRegistry.registerBeanDefinition(name, new RedisDataSourceBeanDefinitionFactory(name).build());
    }
}
 
開發者ID:lodsve,項目名稱:lodsve-framework,代碼行數:14,代碼來源:RedisBeanDefinitionRegistrar.java

示例13: assertMetaAnnotationOverrides

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
private void assertMetaAnnotationOverrides(AnnotationMetadata metadata) {
	AnnotationAttributes attributes = (AnnotationAttributes) metadata.getAnnotationAttributes(
			TestComponentScan.class.getName(), false);
	String[] basePackages = attributes.getStringArray("basePackages");
	assertThat("length of basePackages[]", basePackages.length, is(1));
	assertThat("basePackages[0]", basePackages[0], is("org.example.componentscan"));
	String[] value = attributes.getStringArray("value");
	assertThat("length of value[]", value.length, is(0));
	Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
	assertThat("length of basePackageClasses[]", basePackageClasses.length, is(0));
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:12,代碼來源:AnnotationMetadataTests.java

示例14: getPackagesToScan

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
/**
 * Inspects the packages to be scanned for {@link RetrofitService} interfaces from the {@link RetrofitServiceScan}
 * import annotation.
 *
 * @param metadata the annotation metadata.
 * @return a set of packages to be scanned for {@link RetrofitService} candidates.
 */
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
    AnnotationAttributes attributes = AnnotationAttributes
            .fromMap(metadata.getAnnotationAttributes(RetrofitServiceScan.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),
                "@RetrofitServiceScan basePackages and value attributes are mutually exclusive");
    }

    Set<String> packagesToScan = new LinkedHashSet<String>();
    packagesToScan.addAll(Arrays.asList(value));
    packagesToScan.addAll(Arrays.asList(basePackages));

    for (Class<?> basePackageClass : basePackageClasses) {
        packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
    }

    if (packagesToScan.isEmpty()) {
        return Collections.singleton(ClassUtils.getPackageName(metadata.getClassName()));
    }

    return packagesToScan;
}
 
開發者ID:troinine,項目名稱:spring-boot-square-oss-support,代碼行數:35,代碼來源:RetrofitServiceFactoryBeanRegistrar.java

示例15: initialize

import org.springframework.core.annotation.AnnotationAttributes; //導入方法依賴的package包/類
@Override
protected void initialize(AnnotationAttributes attributes, AppstatusConfigBuilder configBuilder) {
    this.urlMappings = attributes.getStringArray("urlMappings");
}
 
開發者ID:appstatus,項目名稱:appstatus-spring-boot-starter,代碼行數:5,代碼來源:AppStatusConfig.java


注:本文中的org.springframework.core.annotation.AnnotationAttributes.getStringArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。