Spring Framework AnnotatedTypeMetadata - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AnnotatedTypeMetadata class.

This code example shows how to use the following methods:getAnnotationAttributes, getClassName
 
 
	@Override 
	public void setImportMetadata(AnnotationMetadata importMetadata) {
		this.enableAsync = AnnotationAttributes.fromMap(
				importMetadata.getAnnotationAttributes(EnableAsync.class.getName(), false));
		Assert.notNull(this.enableAsync,
				"@EnableAsync is not present on importing class " + importMetadata.getClassName());
	} 
 
	/** 
	 * Collect any {@link AsyncConfigurer} beans through autowiring. 
	 */ 
	@Autowired(required=false) 
	void setConfigurers(Collection<AsyncConfigurer> configurers) {
		if (CollectionUtils.isEmpty(configurers)) {
			return; 
		} 
		if (configurers.size() > 1) {
			throw new IllegalStateException("Only one AsyncConfigurer may exist");
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAnnotationAttributes, getClassName
	protected CacheErrorHandler errorHandler;
 
	@Override 
	public void setImportMetadata(AnnotationMetadata importMetadata) {
		this.enableCaching = AnnotationAttributes.fromMap(
				importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false));
		Assert.notNull(this.enableCaching,
				"@EnableCaching is not present on importing class " + 
						importMetadata.getClassName());
	} 
 
	@Autowired(required = false) 
	void setConfigurers(Collection<C> configurers) {
		if (CollectionUtils.isEmpty(configurers)) {
			return; 
		} 
		if (configurers.size() > 1) {
			throw new IllegalStateException(configurers.size() + " implementations of " +
					"CachingConfigurer were found when only 1 was expected. " + 
					"Refactor the configuration such that CachingConfigurer is " + 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:isAnnotated
	 * @param metadata the metadata of the annotated class 
	 * @return {@code true} if the given class is to be processed as a full 
	 * configuration class, including cross-method call interception 
	 */ 
	public static boolean isFullConfigurationCandidate(AnnotationMetadata metadata) {
		return metadata.isAnnotated(Configuration.class.getName());
	} 
 
	/** 
	 * Check the given metadata for a lite configuration class candidate 
	 * (e.g. a class annotated with {@code @Component} or just having 
	 * {@code @Import} declarations or {@code @Bean methods}). 
	 * @param metadata the metadata of the annotated class 
	 * @return {@code true} if the given class is to be processed as a lite 
	 * configuration class, just registering it and scanning it for {@code @Bean} methods 
	 */ 
	public static boolean isLiteConfigurationCandidate(AnnotationMetadata metadata) {
		// Do not consider an interface or an annotation... 
		if (metadata.isInterface()) {
			return false; 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAnnotationAttributes, isAnnotated
	public static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd) {
		processCommonDefinitionAnnotations(abd, abd.getMetadata());
	} 
 
	static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd, AnnotatedTypeMetadata metadata) {
		if (metadata.isAnnotated(Lazy.class.getName())) {
			abd.setLazyInit(attributesFor(metadata, Lazy.class).getBoolean("value"));
		} 
		else if (abd.getMetadata().isAnnotated(Lazy.class.getName())) {
			abd.setLazyInit(attributesFor(abd.getMetadata(), Lazy.class).getBoolean("value"));
		} 
 
		if (metadata.isAnnotated(Primary.class.getName())) {
			abd.setPrimary(true);
		} 
		if (metadata.isAnnotated(DependsOn.class.getName())) {
			abd.setDependsOn(attributesFor(metadata, DependsOn.class).getStringArray("value"));
		} 
 
		if (abd instanceof AbstractBeanDefinition) {

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Spring Framework AnnotatedTypeMetadata Methods: