本文整理汇总了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"));
}
}
}
示例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!");
}
示例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!");
}
示例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"));
}
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
}