当前位置: 首页>>代码示例>>Java>>正文


Java AnnotatedTypeMetadata.isAnnotated方法代码示例

本文整理汇总了Java中org.springframework.core.type.AnnotatedTypeMetadata.isAnnotated方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotatedTypeMetadata.isAnnotated方法的具体用法?Java AnnotatedTypeMetadata.isAnnotated怎么用?Java AnnotatedTypeMetadata.isAnnotated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.core.type.AnnotatedTypeMetadata的用法示例。


在下文中一共展示了AnnotatedTypeMetadata.isAnnotated方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processCommonDefinitionAnnotations

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
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) {
		AbstractBeanDefinition absBd = (AbstractBeanDefinition) abd;
		if (metadata.isAnnotated(Role.class.getName())) {
			absBd.setRole(attributesFor(metadata, Role.class).getNumber("value").intValue());
		}
		if (metadata.isAnnotated(Description.class.getName())) {
			absBd.setDescription(attributesFor(metadata, Description.class).getString("value"));
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:AnnotationConfigUtils.java

示例2: getMatchOutcome

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    if (!metadata.isAnnotated(ConditionalOnDevelopment.class.getName())) {
        return ConditionOutcome.match(StringUtils.EMPTY);
    }

    Boolean isDevMode = Env.getBoolean("application.devMode", null);
    if (null == isDevMode) {
        isDevMode = Env.getBoolean("application.dev-mode", null);
    }

    isDevMode = null == isDevMode ? false : isDevMode;

    if (!isDevMode) {
        return ConditionOutcome.noMatch("this is not dev-mode!");
    }

    return ConditionOutcome.match("this is dev-mode!");
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:20,代码来源:OnDevelopmentConditional.java

示例3: getMatchOutcome

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
    if (!metadata.isAnnotated(ConditionalOnProperty.class.getName())) {
        return ConditionOutcome.match(StringUtils.EMPTY);
    }

    Map<String, Object> attributes = metadata.getAnnotationAttributes(ConditionalOnProperty.class.getName());
    String key = attributes.get("key").toString();
    String value = attributes.get("value").toString();

    String realValue = Env.getString(key);

    if (!value.equals(realValue)) {
        return ConditionOutcome.noMatch(String.format("@ConditionalOnProperties's key:[%s], found value:[%s], not match given value:[%s]!", key, realValue, value));
    }

    return ConditionOutcome.match("@ConditionalOnProperties's key:[%s], found value:[%s], given value:[%s], matched!");
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:19,代码来源:OnPropertyCondition.java

示例4: processCommonDefinitionAnnotations

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
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() != metadata && 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) {
		AbstractBeanDefinition absBd = (AbstractBeanDefinition) abd;
		if (metadata.isAnnotated(Role.class.getName())) {
			absBd.setRole(attributesFor(metadata, Role.class).getNumber("value").intValue());
		}
		if (metadata.isAnnotated(Description.class.getName())) {
			absBd.setDescription(attributesFor(metadata, Description.class).getString("value"));
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:26,代码来源:AnnotationConfigUtils.java

示例5: getMatchOutcome

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	boolean webApplicationRequired = metadata
			.isAnnotated(ConditionalOnWebApplication.class.getName());
	ConditionOutcome webApplication = isWebApplication(context, metadata);

	if (webApplicationRequired && !webApplication.isMatch()) {
		return ConditionOutcome.noMatch(webApplication.getMessage());
	}

	if (!webApplicationRequired && webApplication.isMatch()) {
		return ConditionOutcome.noMatch(webApplication.getMessage());
	}

	return ConditionOutcome.match(webApplication.getMessage());
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:OnWebApplicationCondition.java

示例6: shouldSkip

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
/**
 * Determine if an item should be skipped based on {@code @Conditional} annotations.
 * @param metadata the meta data
 * @param phase the phase of the call
 * @return if the item should be skipped
 */
public boolean shouldSkip(AnnotatedTypeMetadata metadata, ConfigurationPhase phase) {
	if (metadata == null || !metadata.isAnnotated(Conditional.class.getName())) {
		return false;
	}

	if (phase == null) {
		if (metadata instanceof AnnotationMetadata &&
				ConfigurationClassUtils.isConfigurationCandidate((AnnotationMetadata) metadata)) {
			return shouldSkip(metadata, ConfigurationPhase.PARSE_CONFIGURATION);
		}
		return shouldSkip(metadata, ConfigurationPhase.REGISTER_BEAN);
	}

	for (String[] conditionClasses : getConditionClasses(metadata)) {
		for (String conditionClass : conditionClasses) {
			Condition condition = getCondition(conditionClass, this.context.getClassLoader());
			ConfigurationPhase requiredPhase = null;
			if (condition instanceof ConfigurationCondition) {
				requiredPhase = ((ConfigurationCondition) condition).getConfigurationPhase();
			}
			if (requiredPhase == null || requiredPhase == phase) {
				if (!condition.matches(this.context, metadata)) {
					return true;
				}
			}
		}
	}

	return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:ConditionEvaluator.java

示例7: getMatchOutcome

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {

    ConditionMessage matchMessage = ConditionMessage.empty();

    boolean enabled = isSpringSecurityEnabled(context);

    if (metadata.isAnnotated(ConditionalOnJuiserSpringSecurityEnabled.class.getName())) {
        if (!enabled) {
            return ConditionOutcome.noMatch(
                ConditionMessage.forCondition(ConditionalOnJuiserSpringSecurityEnabled.class)
                    .didNotFind("spring security enabled").atAll());
        }
        matchMessage = matchMessage.andCondition(ConditionalOnJuiserSpringSecurityEnabled.class)
            .foundExactly("spring security enabled");
    }

    if (metadata.isAnnotated(ConditionalOnJuiserSpringSecurityDisabled.class.getName())) {
        if (enabled) {
            return ConditionOutcome.noMatch(
                ConditionMessage.forCondition(ConditionalOnJuiserSpringSecurityDisabled.class)
                    .didNotFind("spring security disabled").atAll());
        }
        matchMessage = matchMessage.andCondition(ConditionalOnJuiserSpringSecurityDisabled.class)
            .didNotFind("spring security disabled").atAll();
    }

    return ConditionOutcome.match(matchMessage);
}
 
开发者ID:juiser,项目名称:juiser,代码行数:30,代码来源:JuiserSpringSecurityCondition.java

示例8: addDeducedBeanType

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
private void addDeducedBeanType(ConditionContext context,
		AnnotatedTypeMetadata metadata, final List<String> beanTypes) {
	if (metadata instanceof MethodMetadata
			&& metadata.isAnnotated(Bean.class.getName())) {
		addDeducedBeanTypeForBeanMethod(context, (MethodMetadata) metadata,
				beanTypes);
	}
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:9,代码来源:OnBeanCondition.java

示例9: getMatchOutcome

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	boolean required = metadata
			.isAnnotated(ConditionalOnWebApplication.class.getName());
	ConditionOutcome outcome = isWebApplication(context, metadata, required);
	if (required && !outcome.isMatch()) {
		return ConditionOutcome.noMatch(outcome.getConditionMessage());
	}
	if (!required && outcome.isMatch()) {
		return ConditionOutcome.noMatch(outcome.getConditionMessage());
	}
	return ConditionOutcome.match(outcome.getConditionMessage());
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:15,代码来源:OnWebApplicationCondition.java

示例10: retrieveAnnotatedProfiles

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
private Set<String> retrieveAnnotatedProfiles(AnnotatedTypeMetadata metadata, String annotationType) {
  if (!metadata.isAnnotated(annotationType)) {
    return Collections.emptySet();
  }

  MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(annotationType);

  if (attributes == null) {
    return Collections.emptySet();
  }

  Set<String> profiles = Sets.newHashSet();
  List<?> values = attributes.get("value");

  if (values != null) {
    for (Object value : values) {
      if (value instanceof String[]) {
        Collections.addAll(profiles, (String[]) value);
      }
      else {
        profiles.add((String) value);
      }
    }
  }

  return profiles;
}
 
开发者ID:ctripcorp,项目名称:apollo,代码行数:28,代码来源:OnProfileCondition.java

示例11: shouldSkip

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
/**
 * Determine if an item should be skipped based on {@code @Conditional} annotations.
 * @param metadata the meta data
 * @param phase the phase of the call
 * @return if the item should be skipped
 */
public boolean shouldSkip(AnnotatedTypeMetadata metadata, ConfigurationPhase phase) {
	if (metadata == null || !metadata.isAnnotated(Conditional.class.getName())) {
		return false;
	}

	if (phase == null) {
		if (metadata instanceof AnnotationMetadata &&
				ConfigurationClassUtils.isConfigurationCandidate((AnnotationMetadata) metadata)) {
			return shouldSkip(metadata, ConfigurationPhase.PARSE_CONFIGURATION);
		}
		return shouldSkip(metadata, ConfigurationPhase.REGISTER_BEAN);
	}

	for (String[] conditionClasses : getConditionClasses(metadata)) {
		for (String conditionClass : conditionClasses) {
			Condition condition = getCondition(conditionClass, context.getClassLoader());
			ConfigurationPhase requiredPhase = null;
			if (condition instanceof ConfigurationCondition) {
				requiredPhase = ((ConfigurationCondition) condition).getConfigurationPhase();
			}
			if (requiredPhase == null || requiredPhase == phase) {
				if (!condition.matches(context, metadata)) {
					return true;
				}
			}
		}
	}

	return false;
}
 
开发者ID:panguixiang,项目名称:my-spring-cache-redis,代码行数:37,代码来源:ConditionEvaluator.java

示例12: addDeducedBeanType

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
private void addDeducedBeanType(ConditionContext context,
		AnnotatedTypeMetadata metadata, final List<String> beanTypes) {
	if (metadata instanceof MethodMetadata
			&& metadata.isAnnotated(Bean.class.getName())) {
		addDeducedBeanTypeForBeanMethod(context, metadata, beanTypes,
				(MethodMetadata) metadata);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:OnBeanCondition.java

示例13: addDeducedBeanType

import org.springframework.core.type.AnnotatedTypeMetadata; //导入方法依赖的package包/类
private void addDeducedBeanType(ConditionContext context,
                                AnnotatedTypeMetadata metadata, final List<String> beanTypes) {
    if (metadata instanceof MethodMetadata && metadata.isAnnotated(Bean.class.getName())) {
        addDeducedBeanTypeForBeanMethod(context, (MethodMetadata) metadata, beanTypes);
    }
}
 
开发者ID:drtrang,项目名称:spring-boot-autoconfigure,代码行数:7,代码来源:OnBeansCondition.java


注:本文中的org.springframework.core.type.AnnotatedTypeMetadata.isAnnotated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。